Hello guys,
I’m trying to understand how coroutines work. I’ve already read all of the documentation that unity has.
Here is what I’m trying to do:
public void Awake()
{
StartCoroutine(cotest());
}
public IEnumerator cotest()
{
for (int x = 0; x <= 1000; x ++)
{
for (int y = 0; y <= 1000; y ++)
{
//do something
}
Debug.Log("I'm in!!!");
yield return new WaitForSeconds(0.1f);
}
}
I want the text “I’m in!!!” to be shown on the console 1000 times. But it only shows once.
It’s has if the the code never comes back to continue the yield.
Can you guys help me? What am I doing wrong?