ssannandeji / Zenject-2019

Dependency Injection Framework for Unity3D
MIT License
2.53k stars 363 forks source link

Zenject causes gameObjects destroying just after start #676

Open mishatron opened 4 years ago

mishatron commented 4 years ago

I am using ProjectContext with next installer:

[CreateAssetMenu(fileName = "DependenciesInstaller", menuName = "Installers/DependenciesInstaller")]
public class DependenciesInstaller : ScriptableObjectInstaller<DependenciesInstaller>
{
    public override void InstallBindings()
    {
        Container.Bind<IGameRepository>().To<GameRepositoryMock>().AsSingle().NonLazy();
        Container.Bind<IAuthRepository>().To<AuthRepository>().AsSingle().NonLazy();
    }
}

On one of the scenes I have some objects that use

public class LettersPanelController : BaseListenableMonoBehaviour
{
    [Inject]
    private readonly IGameRepository gameRepository;
...
}

And just near 1 sec after starting the scene i got message that my object (LettersPanelController ) was destroyed. It is some error of ProjectContext, I suppose, because before it, I used only SceneContext(with installer) and it worked