/// <summary> /// 释放一个场景里面所有资源 /// </summary> /// <param name="sceneName">Scene name.</param> public void Dispose(string sceneName) { List <string> disposeAb = new List <string>(); foreach (string key in dicAbCach.Keys) { string tempSceneName = dicAbCach[key].AbParam.SceneName; if (tempSceneName.Equals(sceneName)) { dicAbCach[key].AbState = EnumAbState.Release; disposeAb.Add(key); } } if (dicAllScenes.ContainsKey(sceneName)) { MultiABMgr multiABMgrObj = dicAllScenes[sceneName]; multiABMgrObj.DisposeAllAsset(); dicAllScenes.Remove(sceneName); } else { Debug.LogWarning(GetType() + "/DisposeAllAssets()/找不到场景名,释放资源失败! sceneName=" + sceneName); } for (int i = 0; i < disposeAb.Count; i++) { dicAbCach.Remove(disposeAb[i]); } }
/// <summary> /// 释放一个场景里面所有资源 /// </summary> /// <param name="sceneName">场景名称(资源分组)</param> public void Dispose(string sceneName) { List <string> disposeAb = new List <string>(); if (dicAllScenes.ContainsKey(sceneName)) { MultiABMgr multiABMgrObj = dicAllScenes[sceneName]; multiABMgrObj.DisposeAllAsset(); dicAllScenes.Remove(sceneName); } else { Debug.LogWarning(GetType() + "/DisposeAllAssets()/找不到场景名,释放资源失败! sceneName=" + sceneName); } }