public void InitUIManager() { //清空缓存的窗体 if (dicAllUI != null) { dicAllUI.Clear(); } if (dicShownUI != null) { dicShownUI.Clear(); } DontDestroyOnLoad(uiRootTrans); //初始化显示窗体的父节点 if (normalUIRoot == null) { normalUIRoot = new GameObject("NormalUIRoot").transform; GameTool.AddChildToParent(uiRootTrans, normalUIRoot); GameTool.SetLayer(uiRootTrans.gameObject.layer, normalUIRoot); } if (KeepAboveUIRoot == null) { KeepAboveUIRoot = new GameObject("KeepAboveUIRoot").transform; GameTool.AddChildToParent(uiRootTrans, KeepAboveUIRoot); GameTool.SetLayer(uiRootTrans.gameObject.layer, KeepAboveUIRoot); } if (topUIRoot == null) { topUIRoot = new GameObject("TopUIRoot").transform; GameTool.AddChildToParent(uiRootTrans, topUIRoot); GameTool.SetLayer(uiRootTrans.gameObject.layer, topUIRoot); } }