I’m not all that familiar with coroutines in Unity. I have this:
private IEnumerator TurnCoroutine()
{
Debug.Log("TurnCoroutine() 1");
yield return DoTurn();
Debug.Log("TurnCoroutine() 2");
}
private IEnumerator DoTurn()
{
//TODO: do stuff
Debug.Log("DoTurn() 1");
yield return new WaitForSeconds(2); //temp
Debug.Log("DoTurn() 2");
}
And I would expect it to log like this:
- TurnCoroutine() 1
- DoTurn() 1
- TurnCoroutine() 2
- DoTurn() 2
But it only logs this:
- TurnCoroutine() 1
- TurnCoroutine() 2
it doesn’t seem to run DoTurn(), can anyone explain to me why?