You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
I have a bit specific case(or not).
In my game I have:
Root Scope
Entry Point Scope(Basically first scene load)
Level Scope
What I want is to declare all needed dependencies only for specific scene. For example for specific Level. While so there should be possibility to declare similar dependencies(I mean bind same Singletons) in other scenes.
What I want to achieve:
User can launch scene on specific level avoiding entry point and this should work without issues, because all dependencies(Singletons) would be created on launch, because they are declared in Scene Scope
User can launch game from Entry Point and then launch Level creating Level Scope. Despite the fact they have similar Singleton binds they should avoid creating local instance of Singleton in case when it's declared in Root Scope.
In my current situation when entering Entry Point Scope(Entry Scene) and it loads Level(Level Scope) 3 instances of the same Singleton creating despite the fact it's already declared(bind) in a Root Scope.
Note: only two instances of CameraManager was actually created(one from Entry Point Scope and another from Level Scope), because Root Scope Start() was not triggered, so it wasn't resolved and created.
Also seems like there is no possibilities to trigger non-lazy Singleton creation from the Root Scope to ensure CameraManager is instantiated(else your would not be able to see the game, lol)
The text was updated successfully, but these errors were encountered:
Watcher3056
changed the title
Singletons: ensure there is Singletons of the same type when bind/resolve them in child-scope!
Singletons: ensure there is no duplicate Singletons of the same type when bind/resolve them in child-scope!
Jan 19, 2024
Hi!
I have a bit specific case(or not).
In my game I have:
What I want is to declare all needed dependencies only for specific scene. For example for specific Level. While so there should be possibility to declare similar dependencies(I mean bind same Singletons) in other scenes.
What I want to achieve:
In my current situation when entering Entry Point Scope(Entry Scene) and it loads Level(Level Scope) 3 instances of the same Singleton creating despite the fact it's already declared(bind) in a Root Scope.
RootScope:
Entry Point Scope:
Level Scope:
Note: only two instances of CameraManager was actually created(one from Entry Point Scope and another from Level Scope), because Root Scope Start() was not triggered, so it wasn't resolved and created.
Also seems like there is no possibilities to trigger non-lazy Singleton creation from the Root Scope to ensure CameraManager is instantiated(else your would not be able to see the game, lol)
The text was updated successfully, but these errors were encountered: