ssannandeji / Zenject-2019

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

Injection is happning twice #672

Closed itzloop closed 4 years ago

itzloop commented 4 years ago

Hi. So ihave a scene with 2 mono installers on a scene context and when i hit play the a splash screen is shown then we will load our scene problem occurs when the scene is open in editor and i press play then i see objects getting created twice and its fine cuz first the scene load then it goes to splash screen then comes back but what happens is zenject will bind some monobehaviour and injects it to other classes then that object gets destroyed but we still have a refrence of it some where in the code. If i let scene run for a while then try to access that monobehaviour it works fine. Then it drove me crazy and i gave a refrence of that object to scene context and used bindInstance and it worked but again after changing to yet another scene which only one of the mono installers in the previous scene and here we go again the dictionary is null at this stage and i realy dont know what to do. Any idea why ? That mono behavior is simple object with a dictionary that shows an arrow on the game objects added to it.