Exemple #1
0
    async public static UniTask WaitUntilEvent(UnityEvent targetEvent)
    {
        Assert.IsNotNull(targetEvent);
        EventListener temp = new EventListener();

        targetEvent.AddListenerForOnce(() => temp.receive = true);
        await UniTask.WaitUntil(() => temp.receive);
    }
Exemple #2
0
    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);
    }
Exemple #3
0
 public void AddListenerForOnce(UnityAction t)
 {
     eChange.AddListenerForOnce(t);
 }