// 创建,加载视图对应的UI资源 private bool Create() { if (Root) { DebugEx.LogError("window create error exist"); return(false); } if (ResName == null || ResName == "") { DebugEx.LogError("window create error res name is empty"); return(false); } Transform transform = GameObject.Find("Canvas").transform; if (transform == null) { DebugEx.LogError("window create error ui camera is empty"); return(false); } GameObject obj = UIResourceLoader.Load(transform, ResName); if (obj == null) { DebugEx.LogError("window create error load res failed " + ResName); return(false); } Root = obj.transform; Root.gameObject.SetActive(false); return(true); }
void Awake() { GameObject popup = UIResourceLoader.Load("UI", "UIPopup"); uiPopup = popup.GetComponent <UIPopup>(); }