示例#1
0
        public void Uninit(bool destroy, bool bBack = true) //类似于析构函数 bBack 默认的是真
        {
            if (obj == null)
            {
                return;
            }
            MenuBase iMenu = obj.GetComponent <MenuBase>(); //得到预设体绑定的脚本

            if (iMenu != null)                              //如果有脚本
            {
                if (iMenu.Uninit(bBack) == true)
                {
                    if (destroy == true)         //如果是要销毁掉
                    {
                        GameObject.Destroy(obj); //销毁当前的预设体实例
                        obj = null;
                    }
                }
            }
            else
            {
                Debug.LogWarningFormat("not found IMenu componet.({0})", obj);
            }
        }