Questions tagged [zenject]

Dependency Injection Framework for Unity3D

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

76 questions
0
votes
0 answers

ECall methods must be packaged into a system module

I'm using Zenject for UnityEngine project and I'm trying to write a unit test for my MenuSystem class but I'm constantly getting error System.Security.SecurityException : ECall methods must be packaged into a system module. This is the stack…
0
votes
0 answers

Zenject instantation error while unit testing a custom prefab factory

I am working on a Unity project using the Extenject / Zenject dependency injection framework, and I am having trouble writing unit tests for custom prefab factories. I have an ArchitectController that needs to instantiate different prefab variants…
KamielDev
  • 481
  • 3
  • 13
0
votes
1 answer

Zenject binding multiple components from instatiated prefab

I ran into the problem of binding components from a child component, a solution to this problem is possible? At the moment I have a solution, but it is inconvenient, you need to forward all methods through 1 component. Example: public inteface…
0
votes
0 answers

I can't inject a second class from an object

I have an embedded Player class. public class PlayerInstaller : MonoInstaller { [SerializeField] private GameObject _playerPrefabs; public override void InstallBindings() { var player =…
0
votes
0 answers

How to use Decorate with Factory in Zenject?

Could someone explain me, how to decorate object created by factory? I've tried like this, but decorator's code not running Container.BindFactory() …
0
votes
1 answer

How to use Zenject to inject a dependency to a class, whose instance is defined as a field in another class

I'd like to have a class that works as a collection for another class. So let's say I have FooBarCollection that has a collection of named FooBarItems. I can bind the FooBarCollection and injecting it works. The problem is that in order to keep…
0
votes
1 answer

How to make a code over scenes? And how to share data between scenes

I started to learn Zenject + Unity. I learned the Zenject readme but I have no unity experience I need shared data between scenes and I want to have some code over the scene. I try to inject some GameData class in two scenes. My scenes have…
0
votes
0 answers

Android app sometimes doesn’t advance when pressing Continue button, but doesn’t register crash or ANR

I have an intermittent bug reported by a few users which I cannot fix or replicate because it doesn’t crash or freeze the app, thus no crash report is generated. Here is the flow of my app when it works: In the Home screen, user presses Continue…
Eatton
  • 455
  • 4
  • 20
0
votes
1 answer

Spawn random objects in game using Zenject Factory Method

I am building an unlimited running car game and for this, I have to spawn other cars randomly. Here is my default installer code: using UnityEngine; using Zenject; public class DefaultInstaller : MonoInstaller { //Total Car Objects public…
mmar58
  • 1
  • 2
0
votes
0 answers

Memory doesn't get free with this structure resulting in a memory leak while using Zenject as a DI Container

I have next structure: TestFacade is a GameObject that gets pooled. public class TestFacade : MonoBehaviour, IPoolable, IDisposable { public class Factory : PlaceholderFactory { } public class Pool :…
stroibot
  • 808
  • 1
  • 11
  • 25
0
votes
0 answers

Awaiting for another context to get initialized first

I have GameObjectContext which is supposed to get a binding from another GameObjectContext to get the same instance of the contracttype. Now it looks like…
Telov
  • 1
  • 1
0
votes
2 answers

Extenject - NullReferenceException when second time inject

I'm new at Zenject(Extenject). My dev environment: Win10, Unity2020, Extenject 9.2.0 Here is my question: In installer bind the class Container.Bind().AsCached(); Inject it at classA private AccountInfo accountInfo; …
Stormer
  • 946
  • 7
  • 10
0
votes
0 answers

How to make 2 singleton referense each other

I working on menu using MVP pattern, so I have 2 singelton presenters. First one is main menu presenter, second is settings menu presenter. First presenter(main menu pres) needs to refernse second (settings pres) and vice versa seconds needs to…
Erik Reiz
  • 3
  • 3
0
votes
2 answers

Why implementing IInitializable in abstract class State using Zenject (Unity) is not working?

I am new in Zenject world. I am modifying a sample code SampleGame1 (Beginner) (you can check the full example here) on Zenject in ShipState by implementing the Iinitializable, the existing one is IDisposable, so there are two implemented Interfaces…
0
votes
1 answer

Behavior disiner + Zenject

Zenject doesn't work with Behavior Disiner. When injected into Action,injection does not occur. [Inject] public void Constructor(GameStateHandler gameStateHandler) { gameStateHandler.OnGameStart(() => _isGameStart = true); …
Danil
  • 1