public static XUIRoot CreateInstance(string path) { var go = GameObject.Find("XUIRoot"); if (go != null) { instance = go.GetComponent <XUIRoot>(); return(null); } if (string.IsNullOrEmpty(path)) { Debug.LogError("场景中没有XUIManagerRoot!!! "); return(null); } var pfb = Resources.Load(path); if (pfb == null) { Debug.LogErrorFormat("资源不存在!!! {0}", path); return(null); } go = Instantiate(pfb, Vector3.zero, Quaternion.identity) as GameObject; DontDestroyOnLoad(go); instance = go.GetComponent <XUIRoot>(); return(instance); }
//闪屏 private void Awake() { if (instance != null && instance != this) { Debug.LogWarningFormat("{0} 只允许存在一个", ToString()); Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); instance = this; }
public XUIManager() { uiRoot = XUIRoot.CreateInstance("XUIRoot"); TextureManager.Init(AssetLoader, LocalizationLoader); }