public static void CreateDebugObject(object obj) { if (!Application.isEditor || !Application.isPlaying || IsApplicationQuited) { return; } KAsync.AddMainThreadCall(() => { try { var newDebugger = new GameObject(string.Format("{0}-{1}", obj.ToString(), obj.GetType())) .AddComponent <KObjectDebugger>(); newDebugger.WatchObject = obj; KDebuggerObjectTool.SetParent(ContainerName, obj.GetType().Name, newDebugger.gameObject); Cache[obj] = newDebugger; } catch (Exception e) { Log.Error(e.Message); } }); }
public static void RemoveDebugObject(object obj) { if (!Application.isEditor || !Application.isPlaying || IsApplicationQuited) { return; } KAsync.AddMainThreadCall(() => { try { KObjectDebugger debuger; if (KObjectDebugger.Cache.TryGetValue(obj, out debuger)) { GameObject.Destroy(debuger.gameObject); } } catch (Exception e) { Log.Error(e.Message); } }); }