8
\$\begingroup\$

I am semi-experienced .NET developer who has just began working with Unity. I am trying to decide on how to make IoC work in Unity 4.X ( I have not yet tested anything), and I wonder what are the good ways of achieving it.

This post and its answers states that Ninject won't work with Unity, however it is old. Is it still true? If yes, what are other means of achieving IoC in Unity ?

Edit 1 : I am targeting mainly Windows platform. So I don't need platform interoperability, I just need it to work.

\$\endgroup\$
1
  • \$\begingroup\$ IIRC Ninject works fine in Mono, so you should be able to use it as a service locator at least. You won't be able to do dependency injection with the classes that are instantiated by Unity, however. \$\endgroup\$ Commented Jun 3, 2014 at 20:26

2 Answers 2

5
\$\begingroup\$

You probably want to look at StrangeIOC.

http://strangeioc.github.io/strangeioc/

It's meant for Unity. The project has been under active development for quite some time, and I keep meaning to check it out, but as of yet I haven't so I can't give you the personal recommendation. But it sounds like exactly like what you want.

\$\endgroup\$
2
  • \$\begingroup\$ This is definitely what you want. I've been using it since its release (essentially) and it's very well put together with great documentation. I honestly can't see myself developing a game in Unity without it. \$\endgroup\$ Commented Jun 4, 2014 at 18:10
  • \$\begingroup\$ Thanks a lot! That is something that so far has exceeded my expectations :) \$\endgroup\$ Commented Jun 4, 2014 at 18:11
1
\$\begingroup\$

I don't know, but nobody did managed to run it under unity: http://forum.unity3d.com/threads/ios-dependency-injection-framework-suggestions.119909/ but can be very outdated. Nonetheless, try to post your question to UnityAnswers, where will you get more likely a proper answer.

\$\endgroup\$
2

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.