Differences in nested coroutines
I'm getting different results with these two methods but I don't understand why.
Method 1:
private IEnumerator NestedCoroutines()
{
IEnumerator coroutineA = SomeCouroutine(paramaterA);
yield return StartCoroutine(coroutineA);
IEnumerator coroutineB = SomeCouroutine(paramaterB);
yield return StartCoroutine(coroutineB);
}
Method 2:
private IEnumerator NestedCoroutines()
{
IEnumerator coroutineA = SomeCouroutine(paramaterA);
while (coroutineA.MoveNext())
{
yield return null;
}
IEnumerator coroutineB = SomeCouroutine(paramaterB);
while (coroutineB .MoveNext())
{
yield return null;
}
}
Method 1 will go through all of coroutineA before starting coroutineB but Method 2 seems to do a little of A then a little of B then a little of A. Any idea why?
Posted Aug 14, 2017, 6:50 PM UTC
07