示例#1
0
    async UniTaskVoid HandleEventB()
    {
        using (var handlerB = buttonB.GetAsyncClickEventHandler())
        {
            while (this != null)
            {
                await handlerB.OnClickAsync();

                mc = null;
            }
        }
    }
示例#2
0
        public IEnumerator WaitUntilValueChanged() => UniTask.ToCoroutine(async() =>
        {
            var v = new MyMyClass {
                MyProperty = 99
            };

            UniTask.DelayFrame(10, PlayerLoopTiming.PostLateUpdate).ContinueWith(_ => v.MyProperty = 1000).Forget();

            var startFrame = Time.frameCount;
            await UniTask.WaitUntilValueChanged(v, x => x.MyProperty, PlayerLoopTiming.EarlyUpdate);

            var diff = Time.frameCount - startFrame;
            diff.Should().Be(11);
        });
示例#3
0
        public IEnumerator WaitUntilValueChanged() => UniTask.ToCoroutine(async() =>
        {
            var v = new MyMyClass {
                MyProperty = 99
            };

            Observable.TimerFrame(10, FrameCountType.EndOfFrame).Subscribe(_ => v.MyProperty = 1000);

            var startFrame = Time.frameCount;
            await UniTask.WaitUntilValueChanged(v, x => x.MyProperty, PlayerLoopTiming.EarlyUpdate);

            var diff = Time.frameCount - startFrame;
            diff.Is(11);
        });