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

Fix PrefabComponentProvider doesnt recursively inject hierarchy #587

Closed AlonTalmi closed 8 months ago

AlonTalmi commented 9 months ago

When instantiating using PrefabComponentProvider, only the registered component is injected and not the entire hierarchy of the prefab.

I changed it so the entire hierarchy is injected, with the parameters provided.

I'm not sure whats a better expected behavior is: injecting the parameters to the entire hierarchy or only to the registered component and the rest injecting only using the container

vercel[bot] commented 9 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
vcontainer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 3, 2023 1:09pm
hadashiA commented 8 months ago

I would not expect Inject to run on Component in all tiers of Gameobject.

The current VContainer has to Register each MonoBehaviour separately, even if it is the same GameObject. So there will probably be duplicates.

Perhaps, if we do this, we should add an API that registers all the hierarchical components.