private IEnumerable ProcessCoroutineQueue() { for (;;) { // TODO: don't assume layer 0? if (CoroutineQueue.Count > 0) { var coroutine = CoroutineQueue.Dequeue().GetSafeCoroutine(); while (coroutine.MoveNext() && coroutine.Current != null) { yield return(coroutine.Current); } } else { yield return(null); } } }