RemoveFromParent() public static method

public static RemoveFromParent ( string bigType, string smallType, GameObject obj ) : void
bigType string
smallType string
obj UnityEngine.GameObject
return void
Ejemplo n.º 1
0
        public static KResourceLoaderDebugger Create(string type, string url, AbstractResourceLoader loader)
        {
            if (IsApplicationQuit)
            {
                return(null);
            }

            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);
        }
Ejemplo n.º 2
0
 // 可供调试删资源
 private void OnDestroy()
 {
     if (!IsRemoveFromParent)
     {
         KDebuggerObjectTool.RemoveFromParent(bigType, Type, gameObject);
         IsRemoveFromParent = true;
     }
 }
Ejemplo n.º 3
0
 private void Update()
 {
     if (TheObject == null && !IsRemoveFromParent)
     {
         KDebuggerObjectTool.RemoveFromParent(bigType, Type, gameObject);
         IsRemoveFromParent = true;
     }
 }