Problem with while loop in Coroutine

Hey Unity Community.

I hope all is well.

I am having a brain fart and can not seam to be able to figure out why this simple test would not work.

void Start(){

IEnumerator whileTest()
		while(true == true)
			yield return new WaitForSeconds(1);
			Debug.Log ("while test working");

What could possibly be the reason why that Debug.log would not show up every second? I checked the time.time by debug.logging it into the update and it works fine. And if I place the Debug.log infront of the yield, it prints. But it never gets past the Waitforseconds.

Thanks all.

Only thing that comes to my mind (apart what Eric5h5 said) is that somehow the MonoBehaviour that started the coroutine was destroyed. Did you check it? Coroutines live and die with the MonoBehaviour that starts them, not with the MonoBehaviour that contains them.

Turn off “collapse” in the console. (Number of times I’ve typed this answer: 500 and counting. :wink: ) By the way, you should generally not use quotes in StartCoroutine unless you intend to use StopCoroutine.