diff --git a/src/UniTask/Assets/Plugins/UniTask/Runtime/EnumeratorAsyncExtensions.cs b/src/UniTask/Assets/Plugins/UniTask/Runtime/EnumeratorAsyncExtensions.cs index 4722b47..c2e4c51 100644 --- a/src/UniTask/Assets/Plugins/UniTask/Runtime/EnumeratorAsyncExtensions.cs +++ b/src/UniTask/Assets/Plugins/UniTask/Runtime/EnumeratorAsyncExtensions.cs @@ -163,11 +163,10 @@ namespace Cysharp.Threading.Tasks { yield return null; } - else if (current is CustomYieldInstruction) + else if (current is CustomYieldInstruction cyi) { // WWW, WaitForSecondsRealtime - var e2 = UnwrapWaitCustomYieldInstruction((CustomYieldInstruction)current); - while (e2.MoveNext()) + while (cyi.keepWaiting) { yield return null; } @@ -212,15 +211,6 @@ namespace Cysharp.Threading.Tasks } } - // WWW and others as CustomYieldInstruction. - static IEnumerator UnwrapWaitCustomYieldInstruction(CustomYieldInstruction yieldInstruction) - { - while (yieldInstruction.keepWaiting) - { - yield return null; - } - } - static readonly FieldInfo waitForSeconds_Seconds = typeof(WaitForSeconds).GetField("m_Seconds", BindingFlags.Instance | BindingFlags.GetField | BindingFlags.NonPublic); static IEnumerator UnwrapWaitForSeconds(WaitForSeconds waitForSeconds)