private static void Update()
        {
            int activeCoroutines = 0;
            int sentinel         = 999999;

            for (int i = s_coroutines.Count - 1; i >= 0 && sentinel > 0; --i, --sentinel)
            {
                var e = s_coroutines[i];
                if (e == null)
                {
                    continue;
                }
                if (e.MoveNext())
                {
                    ++activeCoroutines;
                    if (e.Current == null)
                    {
                    }
                    else if (e.Current is WWW)
                    {
                        s_coroutines[i] = EditorCoroutineRunner.waitForWWW((WWW)e.Current, i, e);
                    }
                    else
                    {
                        throw new System.NotImplementedException("EditorCoroutineRunner can't handle " + e.Current.GetType() + " yet. Add this type to EditorCoroutineRunner.cs");
                    }
                }
                else
                {
                    ++i;
                }
            }
            if (sentinel == 0)
            {
                s_coroutines.Clear();
                EditorApplication.update -= Update;
                throw new System.InvalidOperationException("Infinite loop in EditorCoroutineRunner.cs. Be careful when adding new wait conditions!");
            }
            if (activeCoroutines == 0)
            {
                s_coroutines.Clear();
                EditorApplication.update -= Update;
            }
        }