Tag: zenject

  • Services and configuration assets for Unity projects

    With many of the projects that I have worked on it has been necessary to support a variety of build targets that are either configured differently or make use of entirely different services. In early projects I would simply use the various symbols that Unity defines such as UNITY_ANDROID but this falls short when supporting multiple Android based platforms. Not to mention dealing with projects that contain multiple reskins of the same core game each with a range of different platforms.

    Continue reading...

  • Separation of concerns with Unity UI

    I have worked with various interpretations of MVC-like patterns over the years and have experimented a lot with applying them to UIs in Unity. The patterns that I found to work best with nGUI and uGUI are MVP (Model-View-Presenter) (passive view) and MVVM (Model-View-ViewModel).

    Continue reading...

  • Dependency injection in Unity with Zenject

    Dependency injection in Unity projects is slightly complicated by the fact that we do not have full control over the initialization of the engine. Unity instantiates it’s various object types (GameObject, Component, MonoBehaviour, ScriptableObject, Material, etc) when scenes and assets are loaded. Put simply… the objects exist before we can do anything with them.

    Continue reading...