Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not Initialize GameObjectContext's kernel until SceneContext is initialized (Disabled AutoRun) #266

Open
olegkuzyk opened this issue May 22, 2022 · 0 comments

Comments

@olegkuzyk
Copy link

In GameObjectContext class we have such lines to initialize the kernel when GOC creates dynamically.

if (gameObject.scene.isLoaded && !_container.IsValidating)
{
    _kernel = _container.Resolve<MonoKernel>();
    _kernel.Initialize();
}

But it works wrong when SceneContext runs manual (toggled of AutoRun) - GOC initializes before SceneContext.

I fixed this problem like this

var sceneContext = _parentContainer.Resolve<SceneContext>();
if (gameObject.scene.isLoaded && !_container.IsValidating && sceneContext.Initialized)
{
    _kernel = _container.Resolve<MonoKernel>();
    _kernel.Initialize();
}

Would be great if you add this to the main code or offer a better solution.

Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant