//实例化UI// public UIBase InstantiatedUI(UIProperty pProperty) { GameObject TmpUI = null; foreach(GameObject TmpObject in UIPrefabArray) { if(TmpObject.name == pProperty.name) TmpUI = TmpObject; } if(TmpUI == null) TmpUI = Resources.Load("UI/"+pProperty.name,typeof(GameObject)) as GameObject; if(TmpUI != null) { UIBase Obj = (Instantiate(TmpUI) as GameObject).GetComponent<UIBase>(); Obj.name = pProperty.name; OtherTool.SetLayer(Obj.gameObject,m_pCameraList[pProperty.GetCameraLayer()].gameObject.layer); Obj.transform.parent = m_pUIAnchorMap[m_pCameraList[pProperty.GetCameraLayer()]] as Transform; Obj.transform.localPosition = Vector3.zero; Obj.transform.localScale = Vector3.one; m_pUIMap[m_pCameraList[pProperty.GetCameraLayer()]] = Obj; return Obj; } LogManager.LogError("Cant Find Target UI Prefab " + pProperty.name); return null; }