IEnumerator Start() { SEUResource.ResisterGroupPath("view", SEULoaderType.AB); //StartCoroutine(vvv()); yield return(vvv()); //yield return null; //float t = Time.realtimeSinceStartup; var res1 = SEUResource.Load(UIType.MainView.Path); Debug.LogError(res1.asset); Debug.LogError("res1 ====="); //var res2 = SEUResource.Load(UIType.NewTestView.Path); //Debug.LogError(res2.asset); //Debug.LogError("res2 ====="); //Debug.Log(Time.realtimeSinceStartup - t); SEUResource.UnLoadResource(res1); //SEUResource.UnLoadResource(res2); yield return(null); }
public GameObject GetSingleUI(UIType uiType) { if (_UIDict.ContainsKey(uiType) == false || _UIDict[uiType] == null) { SEUResource res = SEUResource.Load(uiType.Path); GameObject go = GameObject.Instantiate(res.asset) as GameObject; go.transform.SetParent(_canvas, false); go.name = uiType.Name; _UIDict.AddOrReplace(uiType, go); _UIResDict.AddOrReplace(uiType, res); return(go); } return(_UIDict[uiType]); }
public void DestroySingleUI(UIType uiType) { if (!_UIDict.ContainsKey(uiType)) { return; } if (_UIDict[uiType] == null) { _UIDict.Remove(uiType); _UIResDict.Remove(uiType); return; } GameObject.Destroy(_UIDict[uiType]); SEUResource.UnLoadResource(_UIResDict[uiType]); _UIDict.Remove(uiType); _UIResDict.Remove(uiType); }
IEnumerator vvv() { Debug.LogError("vvvvvvvvvv"); var t = Time.realtimeSinceStartup; SEUResource.Request res3 = SEUResource.LoadAsyn(UIType.MainView.Path); Debug.LogError(res3); yield return(res3); Debug.LogError(res3.resource.asset); Debug.LogError("res3 ====="); var res4 = SEUResource.LoadAsyn(UIType.NewTestView.Path); yield return(res4); Debug.LogError(res4.resource.asset); Debug.LogError("res 4====="); SEUResource.UnLoadResource(res3.resource); SEUResource.UnLoadResource(res4.resource); Debug.Log(Time.realtimeSinceStartup - t); }