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;
}
}
}