Here’s the scenario: I’ve got a simple for loop in a coroutine that was working perfectly, and then suddenly stopped evaluating.
Here’s what is looks like, with some debug messages I added in:
public static IEnumerator CamGoHome () {
// do stuff
yield return new WaitForSeconds (flyTime);
Debug.Log ("hi1");
for (int i = 20; i <= 0; i--) {
Debug.Log ("hi2");
grey.renderer.enabled = !grey.renderer.enabled;
// yield return new WaitForSeconds (0.5f * i);
}
Debug.Log ("hi3");
// do other stuff
}
So, this worked before: the renderer of grey blinked, and this worked in multiple tests. I fiddled with the yield return timing in the for loop, saved, and … the for loop suddenly stopped evaluating.
I’ve changed the int used in the for loop, the parameters, cleared the loop out completely. I’ve deleted it and rewritten it. The coroutine always completes (I see the “hi1” and “hi3” messages in the console every time) but it seems to just completely ignore the for loop, or any new for loop of any kind written into the same section of the routine. If I write a for loop up above, it does work, but in that particular section of code it’s just invisible.
Anyone know what would cause this?