public static CoroutineController StartCoroutineController(this MonoBehaviour monoBehaviour, IEnumerator routine) { CoroutineController coroutineController = new CoroutineController(); coroutineController.StartCoroutine(monoBehaviour, routine); return(coroutineController); }
private IEnumerator Run() { int numChildCoroutinePopped = 0; while (true) { CurrentExecuting = this; object obj = _enumeratorStack.RunOnce(); CurrentExecuting = null; if (_enumeratorStack.Count == 0) { break; } if (EnumeratorStack.IsChildCoroutine(obj)) { numChildCoroutinePopped = 0; } else if (obj != null && obj is BreakZeroFrame) { numChildCoroutinePopped = 0; } else if (EnumeratorStack.WasChildCoroutinePopped(obj)) { numChildCoroutinePopped++; if (numChildCoroutinePopped >= 30) { Log.Warning(LogGroups.Engine, "Potentially in an infinite coroutine loop. Force yielding."); numChildCoroutinePopped = 0; yield return(null); } } else { numChildCoroutinePopped = 0; yield return(obj); } } Stop(); }