hadashiA / VContainer

The extra fast, minimum code size, GC-free DI (Dependency Injection) library running on Unity Game Engine.
https://vcontainer.hadashikick.jp
MIT License
1.88k stars 163 forks source link

Awake of RootLifetimeScope component is not working. #622

Closed KazukiKuriyama closed 6 months ago

KazukiKuriyama commented 7 months ago

A MonoBehaviour component for game preferences is attached in the RootLifetimeScope game object and registers the game default values from Inspector. I am currently using this component with IInitializable attached to it, as it does not seem to be able to run Awake if I register it with RegisterComponent. Is it possible to get Awake to work?

Watcher3056 commented 6 months ago

I think Hadashi better to instantiate RootLifeTimeScope as DontDestroyOnLoad instead of referencing just a prefab.

I also expected Awake to work in order to execute some logic such as Resolve of some singletons in order to create them when game starts(such as CameraManager, DevConsole etc.)

Btw, how you succeeded to work it with IInitializable?

hadashiA commented 6 months ago

Thanks for the feedback. I have made the decision to make the change to Insatntiate. Fixed in #627