void Awake ()
{
Count();
}
void Count (int sec = 10)
{
for (int i = 0; i < 10; i++)
{
print(sec);
StartCoroutine(Delay());
sec -= 1;
if (sec < 1)
{
print("GO!");
StopCoroutine(Delay());
}
}
}
IEnumerator Delay(int waitSec = 10)
{
yield return new WaitForSeconds(waitSec);
}
The result is that the console instantly print everything without waiting for ten seconds even with this coroutine. Why so?
Thanks!