Cysharp / UniTask

Provides an efficient allocation free async/await integration for Unity.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add UniTask.WaitUntil overload which takes a target to avoid closure allocation

laicasaane opened this issue · comments

For the context of this proposal:
Since UniTask.WaitUntilValueChanged uses IEqualityComparer to detect if the value has changed, its logic is totally different from UniTask.WaitUntil. So I can't just replace WaitUntil with WaitUntilValueChanged.

My use case is:

var component = await UniTask.WaitUntil(gameObject, static x => x.GetComponent<MyComponent>());

// do something to the retrieved component

I think it's a good idea to add (TState, Func) overloads throughout.