-
Notifications
You must be signed in to change notification settings - Fork 273
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
Circular Dependency with GameObjectContext #6
Comments
Yeah that makes sense to me. Triggering injection of the game object context after storing the |
…at are used with FromSubContainerResolve factory (issue #6)
Ok this should be fixed now. This change should address a lot of other existing problems with circular dependencies + FromSubContainerResolve too. Thanks for reporting this |
…at are used with FromSubContainerResolve factory (issue #6)
Hello.
There is a problem with circular dependencies between a Subcontainer in a GameObjectContext and a type in the scene context
Main -> Foo (Main in GameObjectContext)
Foo-> Main (Foo in SceneContext)
In older versions, this caused that the GameObjectContext to be instantiated several times.
I have seen that now this is prevented by SubContainerCreatorCached._isLookingUp.
But I think the real issue is here:
_subCreator.CreateSubContainer has two parts, the creation and the injection, but the _subContainer reference is got after the injection, so
I think a solution to this could be to split CreateSubContainer in two parts.
The first part would be to instantiate the gameobject context, create a subcontainer, set it to the gameobject context and get the reference in SubContainerCreatorCached.
After this, we inject the gameobject context. This way, if we enter again in CreateSubContainer because of a circular dependency, _subContainer is no longer null
I have done a very dirty prototype just to illustrate what I mean.
What do you think?
Thank you
The text was updated successfully, but these errors were encountered: