ssannandeji / Zenject-2019

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

Cross scene binding not working with ContractNames set up on SceneContexts #602

Open Deadcows opened 5 years ago

Deadcows commented 5 years ago

I've got two scenes, Gameplay and Level. Both have SceneContexts attached, one with ContractName "Gameplay" and other with ParentContractName "Gameplay". But I cannot Inject anything from Gameplay scene to Level scene behaviours.

Lets say I have "InteractiveSelection" MonoBehaviout on the GO in Gameplay scene and with ZenjectBinding on the same GO with Components set to this "InteractiveSelection".

In Level scene I've got a bunch of Interactive components with the field "[Inject] InteractiveSelection _selectionUI;" and all I've got is a bunch of "ZenjectException: Unable to resolve 'InteractiveSelection' while building object with type 'Interactive' errors...

Bindings on Gameplay scene to behaviours on the same scene works just fine. I ensured that Gameplay scene is loaded first in editor (in playmode Gameplay scene is always loaded and different Level scenes is loaded, one at a time)