// 可供调试删资源
 private void OnDestroy()
 {
     if (!IsRemoveFromParent)
     {
         KDebuggerObjectTool.RemoveFromParent(bigType, Type, gameObject);
         IsRemoveFromParent = true;
     }
 }
 private void Update()
 {
     if (TheObject == null && !IsRemoveFromParent)
     {
         KDebuggerObjectTool.RemoveFromParent(bigType, Type, gameObject);
         IsRemoveFromParent = true;
     }
 }
示例#3
0
        public static KResourceLoaderDebugger Create(string type, string url, AbstractResourceLoader loader)
        {
            if (IsApplicationQuit)
            {
                return(null);
            }

            const string bigType = "ResourceLoaderDebuger";

            Func <string> getName = () => string.Format("{0}-{1}-{2}", type, url, loader.Desc);

            var newHelpGameObject = new GameObject(getName());

            KDebuggerObjectTool.SetParent(bigType, type, newHelpGameObject);
            var newHelp = newHelpGameObject.AddComponent <KResourceLoaderDebugger>();

            newHelp.TheLoader = loader;

            loader.SetDescEvent += (newDesc) =>
            {
                if (loader.RefCount > 0)
                {
                    newHelpGameObject.name = getName();
                }
            };

            loader.DisposeEvent += () =>
            {
                if (!IsApplicationQuit)
                {
                    KDebuggerObjectTool.RemoveFromParent(bigType, type, newHelpGameObject);
                }
            };

            return(newHelp);
        }