KEngine.KObjectDebugger.CoGlobalDebugCoroutine C# (CSharp) Method

CoGlobalDebugCoroutine() private static method

主要为了清理和改名
private static CoGlobalDebugCoroutine ( ) : IEnumerator
return IEnumerator
        private static IEnumerator CoGlobalDebugCoroutine()
        {
            while (true)
            {
                if (Cache.Count <= 0)
                {
                    yield return null;
                    continue;
                }

                var copyCache = new Dictionary<object, KObjectDebugger>();
                foreach (var kv in Cache) // copy
                {
                    copyCache[kv.Key] = kv.Value;
                }

                foreach (var kv in copyCache)
                {
                    var debugger = kv.Value;
                    if (debugger.WatchObject == null)
                    {
                        GameObject.Destroy(debugger._cacheGameObject);
                    }
                    else
                    {
                        if (!debugger.IsDestroyed && debugger._cacheGameObject.name != debugger.WatchObject.ToString())
                        {
                            debugger._cacheGameObject.name = debugger.WatchObject.ToString();
                        }
                    }
                    yield return null;
                }
            }
        }