diff --git a/src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/ContinuationQueue.cs b/src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/ContinuationQueue.cs index 30bd737..5458a5d 100644 --- a/src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/ContinuationQueue.cs +++ b/src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/ContinuationQueue.cs @@ -170,8 +170,8 @@ namespace Cysharp.Threading.Tasks.Internal for (int i = 0; i < actionListCount; i++) { - var action = actionList[i]; - actionList[i] = null; + + ref var action = ref actionList[i];//Reduce array bounds check try { @@ -181,6 +181,7 @@ namespace Cysharp.Threading.Tasks.Internal { UnityEngine.Debug.LogException(ex); } + action = null; } { diff --git a/src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/PlayerLoopRunner.cs b/src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/PlayerLoopRunner.cs index 621ba5a..28babed 100644 --- a/src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/PlayerLoopRunner.cs +++ b/src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/PlayerLoopRunner.cs @@ -143,6 +143,7 @@ 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++) {