I already have created a object by Activator.CreateInstance().
How can I inject dependency that object having?
As a reference, I use c# and zenject of Unity3d.
public abstract class Task
{
[Inject(Id = "Json")]
protected ISerializer…
I am writing unit tests for Extenject (Zenject) and using ZenjectUnitTestFixture but it looks like some of my singletons are not being recreated after test [Setup]. I have set breakpoints and checked that the Container registrations are being…
I'm getting a ZenjectException: Unable to resolve 'Facade'. Object graph: error that I can't understand.
I've been following this example but I can't get my code to work.
I have a prefab with the following components:
Facade
FacadeInstaller
Game…
I'm using Zenject, but this can apply to other frameworks as well. I'm not thrilled with boiler-plate code that i have to copy/paste all over. In this case, OnEnable should subscribe to a signal, OnDisable should unsubscribe. Can an attribute be…
I'm trying to inject plain C# class into Mobobehaviour, but an "Unable to resolve 'HeightSystem' while building object with type 'UserDirijible'. Object graph: UserDirijible" exception is thrown.
namespace Systems {
public class HeightSystem
…
I am using Zenject for dependency injection in my game, and I am in an impasse.
Let me describe my current setup:
I have several characters with their own GameObjectContext and CharacterInstaller responsible for injecting a CharacterController into…
I want to organize my code as well as I can, but I have some trouble with its organization. I try to use SOLID principles and make separate entities. I want to use MVVM to view (unity-weld as well), and DI container (zenject as well).
It's my first…
I have an array of prefabs and I want to be able to Instantiate randomly picked prefabs thru Zenject Factory and perform their bindings in their sub-containers.
What I want to do is the same as in this code sample from Zenject documentation, but…
I have a game object (a cube, let's say) which exists in the scene, and I want it to have an injectable component. I want to be able to say, for example: My cube has an IShotFirer member, which can resolve to either a BoomShotFirer or a…
I have SceneA (A) and SceneB (B). The B has also a Foo AsSingle and NonLazy installed by the SceneContext Installer. The Foo has an IInitialize implemented to Debog.Log("Hello Errors!"):
yield return LoadScene("SceneA");
yield return new…
How to switch scene during scene test, in a class extending SceneTestFixture?
I need to make a test case while extending SceneTestFixture , where during the test I load Scene 'A' and it set a condition to ProjectContext and then in the same test…
The documentation says that you can easily swap between multiple ScriptableObjectInstallers. And i think you do this by assigning needed ScriptableObjectInstaller of a same class in SceneContext.
But what if i want to procedurally decide which…