From 5d4a90e9bdee2916b4e08016b0e293603195e04e Mon Sep 17 00:00:00 2001 From: neuecc Date: Mon, 21 Sep 2020 11:42:02 +0900 Subject: [PATCH] fix broken loop-runner from 2.0.32, #172 --- .../UniTask/Runtime/Internal/PlayerLoopRunner.cs | 2 -- src/UniTask/Assets/Tests/DelayTest.cs | 11 +++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/PlayerLoopRunner.cs b/src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/PlayerLoopRunner.cs index 28babed..b459861 100644 --- a/src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/PlayerLoopRunner.cs +++ b/src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/PlayerLoopRunner.cs @@ -143,8 +143,6 @@ namespace Cysharp.Threading.Tasks.Internal { var j = tail - 1; - var loopItems = this.loopItems; - // eliminate array-bound check for i for (int i = 0; i < loopItems.Length; i++) { var action = loopItems[i]; diff --git a/src/UniTask/Assets/Tests/DelayTest.cs b/src/UniTask/Assets/Tests/DelayTest.cs index 7102f4e..3040341 100644 --- a/src/UniTask/Assets/Tests/DelayTest.cs +++ b/src/UniTask/Assets/Tests/DelayTest.cs @@ -200,5 +200,16 @@ namespace Cysharp.Threading.TasksTests okay1.Should().Be(true); okay2.Should().Be(true); }); + + + [UnityTest] + public IEnumerator LoopTest() => UniTask.ToCoroutine(async () => + { + for (int i = 0; i < 20; ++i) + { + UniTask.DelayFrame(100).Forget(); + await UniTask.DelayFrame(1); + } + }); } } \ No newline at end of file