public void syncUpdateModel() { if (m_bNeedReloadModel) { if (m_modelRes != null) { Ctx.m_instance.m_modelMgr.unload(m_modelRes.GetPath(), null); m_modelRes = null; } if (m_selfGo != null) { UtilApi.Destroy(m_selfGo); m_selfGo = null; } m_modelRes = Ctx.m_instance.m_modelMgr.getAndSyncLoad <ModelRes>(m_modelResPath); selfGo = m_modelRes.InstantiateObject(m_modelResPath); attach2Parent(); m_modelInsDisp.dispatchEvent(this); } m_bNeedReloadModel = false; }
override public void onExit() { base.onExit(); m_tuJianData.dispose(); UtilApi.Destroy(m_tuJianData.m_form.m_GUIWin.m_uiRoot); //UtilApi.UnloadUnusedAssets(); }
public void unload() { if (m_go != null) { UtilApi.Destroy(m_go); m_go = null; Ctx.m_instance.m_resLoadMgr.unload(m_path, onLoadEventHandle); } }
// unity 自己产生的 bug ,DontDestroyOnLoad 的对象,加载 Level 后会再产生一个 private void BugResolve() { GameObject[] nodestroy = GameObject.FindGameObjectsWithTag("App"); //得到存在的实例列表 if (nodestroy.Length > 1) { // 将后产生的毁掉,保留第一个 //GameObject.Destroy(nodestroy[1]); UtilApi.Destroy(nodestroy[1]); } }
public override void hide() { base.hide(); UtilApi.Destroy(m_cardItem.getGameObject()); foreach (HistoryTipsCard item in m_list) { UtilApi.Destroy(item.getGameObject()); } }
// 关闭拖放功能 override public void disableDrag() { UIDragObject drag = m_card.gameObject().GetComponent <UIDragObject>(); //drag.enabled = false; UtilApi.Destroy(drag); WindowDragTilt dragTitle = m_card.gameObject().GetComponent <WindowDragTilt>(); //dragTitle.enabled = false; UtilApi.Destroy(dragTitle); }
override public void dispose() { if (m_selfGo != null) { UtilApi.Destroy(m_selfGo); m_selfGo = null; } if (m_modelRes != null) { Ctx.m_instance.m_modelMgr.unload(m_modelRes.GetPath(), null); m_modelRes = null; } base.dispose(); }
public override void onExit() { base.onExit(); int idx = 0; for (idx = 0; idx < (int)CardBtnEnum.eCardBtnTotal; ++idx) { m_cardBtnArr[idx].dispose(); } disposeCard(); foreach (var item in m_cardGo) { UtilApi.Destroy(item); } }
public void updateModel() { if (m_bNeedReloadModel) { if (m_modelRes != null) { Ctx.m_instance.m_modelMgr.unload(m_modelRes.GetPath(), null); m_modelRes = null; } if (m_selfGo != null) { UtilApi.Destroy(m_selfGo); m_selfGo = null; } LoadParam param; param = Ctx.m_instance.m_poolSys.newObject <LoadParam>(); param.m_path = m_resPath; // 这个需要立即加载 param.m_loadNeedCoroutine = false; param.m_resNeedCoroutine = false; m_modelRes = Ctx.m_instance.m_modelMgr.getAndLoad <ModelRes>(param); Ctx.m_instance.m_poolSys.deleteObj(param); m_selfGo = m_modelRes.InstantiateObject(m_resPath); if (m_bNeedPlaceHolderGo) { if (m_placeHolderGo == null) { m_placeHolderGo = new UnityEngine.GameObject(); UtilApi.SetParent(m_placeHolderGo, m_pntGo, false); } UtilApi.SetParent(m_selfGo, m_placeHolderGo, false); } else { UtilApi.SetParent(m_selfGo, m_pntGo, false); } } m_bNeedReloadModel = false; }
protected void testLoadAnimatorControllerPrefab() { LoadParam param; param = Ctx.m_instance.m_poolSys.newObject <LoadParam>(); LocalFileSys.modifyLoadParam("Animation/Scene/Control.prefab", param); param.m_loadNeedCoroutine = false; param.m_resNeedCoroutine = false; PrefabResItem bbb = Ctx.m_instance.m_resLoadMgr.getAndLoad(param) as PrefabResItem; Ctx.m_instance.m_poolSys.deleteObj(param); GameObject _go = UtilApi.createGameObject("AnimatorController"); Animator animator = _go.AddComponent <Animator>(); GameObject _insObj = bbb.InstantiateObject(""); RuntimeAnimatorController controlCom = _insObj.GetComponent <Animator>().runtimeAnimatorController; //_insObj.GetComponent<Animator>().runtimeAnimatorController = null; RuntimeAnimatorController copyCom = RuntimeAnimatorController.Instantiate(controlCom); animator.runtimeAnimatorController = copyCom; //UtilApi.SetParent(_insObj, _go); UtilApi.Destroy(_insObj); }
public new void dispose() { destroyCrad(); UtilApi.Destroy(m_cardGo); }