ICompositionRoot.OnContextDestroyed called twice in Example2-Unity Hybrid-Survival
kenshin12269 opened this issue · 2 comments
kenshin12269 commented
In Example2-Unity Hybrid-Survival, if player dies, RestartGameOnPlayerDeathEngine fires SceneManager.LoadScene, and UnityContext.Awake adds Application.wantsToQuit delegate again. And when I stop the game, then above error occurs.
public class UnityContext<T> : UnityContext where T : class, ICompositionRoot, new()
{
void Awake()
{
_applicationRoot = new T();
_applicationRoot.OnContextCreated(this);
Application.wantsToQuit += IsQuitting;
}
bool IsQuitting()
{
_isQuitting = true;
_applicationRoot.OnContextDestroyed();
return true;
}
}
I guess the problem is removing IsQuitting function delegate when UnityContext.OnDestroy is called I guess.
sebas77 commented
I think I may have fixed this too in the new svelto release, are you in our discord server btw? I will answer quicker there.
kenshin12269 commented
I think I may have fixed this too in the new svelto release, are you in our discord server btw? I will answer quicker there.
Yeah I'm logged in discord name of 'SunnyKim'. I'll ask there from now on. Thanks