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
I was hoping to create a factory to create a Npc class that responds to IStartable, ITickable. But by registering Npc as Lifetime.Transient and AsImplementedInterfaces() it will create 2 Npc instances immediately. It seems VContainer resolves all classes that implement IStartable, ITickable on startup to collect C# classes that need updating. I wonder if there is a way to resolve/create Npc class instances later but being able to get called by IStartable.Start and ITickable.Tick? Or it has to be the other way around i.e. MonoNpc owning and updating Npc instead of Npc owning MonoNpc and updated by VContainer?
And I would also like to ask is it possible to make LifetimeScope.Configure() async? It seems not working if I mark it async and use await _npcPrefab.LoadAssetAsync<GameObject>(); in it.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I have following classes:
And I register in the
LifeTimeScopelikeI was hoping to create a factory to create a
Npcclass that responds toIStartable,ITickable. But by registeringNpcasLifetime.TransientandAsImplementedInterfaces()it will create 2Npcinstances immediately. It seems VContainer resolves all classes that implementIStartable,ITickableon startup to collect C# classes that need updating. I wonder if there is a way to resolve/createNpcclass instances later but being able to get called byIStartable.StartandITickable.Tick? Or it has to be the other way around i.e.MonoNpcowning and updatingNpcinstead ofNpcowningMonoNpcand updated by VContainer?And I would also like to ask is it possible to make
LifetimeScope.Configure()async? It seems not working if I mark it async and useawait _npcPrefab.LoadAssetAsync<GameObject>();in it.Thank you.
Beta Was this translation helpful? Give feedback.
All reactions