async public static UniTask WaitUntilEvent(UnityEvent targetEvent) { Assert.IsNotNull(targetEvent); EventListener temp = new EventListener(); targetEvent.AddListenerForOnce(() => temp.receive = true); await UniTask.WaitUntil(() => temp.receive); }
async public static UniTask <T> WaitUntilEvent <T>(UnityEvent <T> targetEvent) { Assert.IsNotNull(targetEvent); EventListener <T> temp = new EventListener <T>(); targetEvent.AddListenerForOnce((T res) => { temp.receive = true; temp.result = res; }); await UniTask.WaitUntil(() => temp.receive); return(temp.result); }
public void AddListenerForOnce(UnityAction t) { eChange.AddListenerForOnce(t); }