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
2.02k stars 176 forks source link

Integration with unity 6 #718

Open shaked-okami opened 3 weeks ago

shaked-okami commented 3 weeks ago

I love VContainer. That is why i am wondering is there any chance to integrate unity 6 new awaitable system in VContainer. This is mainly a problem with the StartAsync that returns a UniTask rather then a Task. Are there any plans to integrate this?

shaked-okami commented 3 weeks ago

Plus looking at the source code, this should be a relative easy solution, since we only need to add a new interface that would return a task

hadashiA commented 1 week ago

I've checked. https://github.com/hadashiA/VContainer/blob/master/VContainer/Assets/VContainer/Runtime/Annotations/IAsyncStartable.cs

If you are using Unity 2023.1 or later, StartAsync is available by default with a return value of UnityEngine.Awaitalble.

If UniTask is installed, UniTask will take precedence. ( Better functionally and performance-wise )

(Also, whatever the return value is you can use Awaitable within the async method.

I thought this worked fine, what changes would you like me to make to this?