Ejemplo n.º 1
0
    public static void CreateDebugObject(object obj)
    {
        if (!Logger.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)
            {
                Logger.LogError(e.Message);
            }
        });
    }
Ejemplo n.º 2
0
    public static void RemoveDebugObject(object obj)
    {
        if (!Logger.IsEditor || !Application.isPlaying || IsApplicationQuited)
        {
            return;
        }

        KAsync.AddMainThreadCall(() =>
        {
            try
            {
                KObjectDebugger debuger;
                if (KObjectDebugger.Cache.TryGetValue(obj, out debuger))
                {
                    GameObject.Destroy(debuger.gameObject);
                }
            }
            catch (Exception e)
            {
                Logger.LogError(e.Message);
            }
        });
    }