Questions tagged [zenject]

Dependency Injection Framework for Unity3D

For further details, see https://github.com/modesttree/Zenject

76 questions
0
votes
1 answer

How to properly inject object-scene dependencies in unity with zenject

I have a scene object with a Fruit test script whose interfaces I want to add to dependencies. To do this, I use the standard Zenject Binding script. However, this doesn't work. Please tell me how can I solve the problem?
Dirol
  • 1
  • 1
0
votes
1 answer

How can i explicitly implement an interface while having implemented that interface multiple times in inheritance chain?

In my Unity C# project I have these interfaces: interface IGameService { void Initialize(params object[] args); } interface IADManager : IGameService { void Show(); } interface IIAPManager : IGameService { void Purchase(); } And a…
0
votes
1 answer

How to deal with instantiated dependencies?

Dealing with instantiated dependencies. So a general question: How to deal with dependencies that is instantiated? Say I have two functions: public class Manager : ScriptableObject { private var data; private void GetDataFromTextAsset() =>…
0
votes
1 answer

Unity 19.4.15 Zenject 9.8 CS1513: But Already Closed All Functions/Class

[edited] Move [inject] label isn't working //<--Because is [Inject] Now it has two error: Assets\player\playercontroller\armory\rifle.cs(10,10): error CS0246: The type or namespace name 'injectAttribute' could not be found (are you missing a using…
黃天貓
  • 29
  • 1
  • 6
0
votes
1 answer

Zenject Why it needs to use InstallerPrefabs instead of my Installer? And what is InstallerPrefabs?

I've created the installer, created a prefab with the script and then attached it to the SceneContext. But When I run I get this error "ZenjectException: Assert hit! Found prefab with name 'Installer' in the Installer property of Context…
0
votes
1 answer

Is there something akin to an ORM for Unity to use Repository Pattern w/ Zenject?

Long form, TL;DR below I'm currently developing a game using Zenject and designed my UI and game architecture very similar to a web app where there are IConversationRepository-Interfaces providing access to data like Conversations with methods like…
Andreas
  • 300
  • 5
  • 15
0
votes
1 answer

Injection of gameobject on scene

So I have gameobject with GameState component on it and I have gameobject with SceneContext, GameInstaller components on it. GameInstaller has field for GameState also I've referenced GameInstaller to monoinstallers. When I'm instantiating player…
0
votes
1 answer

Injecting run-time parameters of IPoolable facade object thru sub-container installer

The problem is that I'm not getting proper values in sub-container installer constructor. For instance, if I'm creating my poolable facadeObject with factory like this: QuxFactory.Create(3.1415); Then in QuxInstaller constructor I'm getting 0 for a…
earthQuake
  • 106
  • 3
  • 11
0
votes
1 answer

How to setup Zenject that when an interface is requested, it setups up a new game object, and returns the a newly bound class instance

Zenject is great, but I haven't found a solution that feels right, for instantiating a game object I have a script, that provides various event hooks for monobehaviour events. Start, PostStart, Update, FixedUpdate, and others, so non-Unity…
user2286552
0
votes
1 answer

Runtime re-binding and re-injecting instances

My question is: can i rebind an instance and re-inject it everywhere i have it injected with [Inject] attribute. Instance was bound like this: [SerializeField] private MyClass inst; public override InstallBindings() { …
earthQuake
  • 106
  • 3
  • 11
0
votes
1 answer

Chose GameObject from SettingCollection

I'm using Zenject framework and I want instansiate gameObject for class created by factory. For this I'm using something like this in GameInstaller Container.BindFactory
0
votes
0 answers

Unity now rolled its own dependency injection framework. What's the future of Inject?

With Unity's Entity Component System data-driven design, it has introduced its own DI framework, including even [Inject] field attributes.…
0
votes
0 answers

Performance issue on changing scene with Zenject

I have a two scenes: Menu and Main. And I have a huge lag on SceneManager.LoadScene("Main"). Here is a data from profiler: https://gyazo.com/da116d1f8e9b429e9170bc3769d23ac4 As I understand 1s delay related to initializing Zenject context. Here is…
Crabar
  • 1,829
  • 1
  • 14
  • 26
0
votes
1 answer

Layered architecture by Zenject's DiContainers

In my application I have three layers: * Data (Entities and Data Access Objects) * Model (Managers) * Presentation (Views) I decided that SubContainers is my choice. In the root GameInstaller I create every container and manually install them with…
Alexandr
  • 3,859
  • 5
  • 32
  • 56
0
votes
0 answers

How to Destroy GameObjects from PrefabInstallers after Installation?

I might have misunderstood the PrefabInstaller but I want to use it to let the LevelDesigner configure settings. However, Zenject seems not to destroy the PrefabInstallers afert installation and so I am left over with unecessary…
Kevin Streicher
  • 484
  • 1
  • 8
  • 25