Mysteries of yield

public GameObject Pool (GameObject thing, float delay) {
StartCoroutine(PoolDelayed(thing, delay, 0));
return thing;
}

IEnumerator PoolDelayed (GameObject thing, float delay, int dummy) {
	Debug.Log ("PoolDelayed is called.");
	yield return new WaitForSeconds (delay);
	Pool (thing);
}

Debug.Log (as well as the actual game) reveals that instead of waiting for delay then proceeding, the whole coroutine is repeated every frame for the whole duration of delay.

I’ve actually heard of some amount of wonkiness regarding everything around yield, but this is the first time I ever have WaitForSeconds() do that in all the times I’ve been using it. Has somebody got some context to it and/or maybe a solution?

You’ve got some weird logic happening here. You are also missing code relevant to the problem here.

The main question is where you are starting the sequence from. If you are calling either Pool () or StartCoroutine (PoolDelay()) every frame from Update you would see the behaviour you are experiencing.

This is not the normal way to code a repetitive loop in a coroutine, the normal way would be to use a while loop.