/// <summary> /// 리소스 로드 합니다^^ /// </summary> /// <param name="sPrefabName"></param> /// <param name="eResourceLoadPos"></param> /// <returns></returns> List <GameObject> GetResourceList(string sPrefabName, E_H_RESOURCELOAD eResourceLoadPos) { List <GameObject> Resource = null; string sSceneName = GetSceneName(eResourceLoadPos.ToString()); foreach (MResourceList list in ResourceList) { if (list.name.Equals(sSceneName)) { Resource = list.resourceList; } } ResourceLoad(sSceneName, sPrefabName, Resource); return(Resource); }
/// <summary> /// 프리펩 삭제하는 함수, 인자가 있어서 인자에 씬 이름을 넣으면 그 씬만 청소해줍니다. /// </summary> /// <param name="sDestroyResourceSceneName"> 리소스를 초기화 할 씬 </param> /// <param name="sDestroyResourceSceneParams"> 리소스를 초기화 할 다른 씬들 </param> public void DestroyPrefabs(E_H_RESOURCELOAD eType, params E_H_RESOURCELOAD[] eTypeParams) { if (CreatePrefabsList == null) { return; } if (CreatePrefabsList.Count == 0) { Debug.Log("CreatePrefabsList.Count == 0 [DestroyPrefab/HPrefabMng.cs]"); return; } var enumerator = CreatePrefabsList.Values.GetEnumerator(); while (enumerator.MoveNext()) { GameObject obj = (GameObject)enumerator.Current; if (obj != null) { Destroy(obj); continue; } } string sResourceScene = GetSceneName(eType.ToString()); string[] sResourcesScene = new string[eTypeParams.Length]; for (int i = 0; i < ResourceList.Count; i++) { if (ResourceList[i].name.Equals(sResourceScene)) { for (int j = 0; j < ResourceList[i].resourceList.Count; j++) { ResourceList[i].resourceList.Remove(ResourceList[i].resourceList[j]); } ResourceList[i].resourceList.Clear(); } for (int j = 0; j < sResourcesScene.Length; j++) { if (ResourceList[i].name.Equals(sResourcesScene[j])) { for (int k = 0; k < ResourceList[i].resourceList.Count; k++) { ResourceList[i].resourceList.Remove(ResourceList[i].resourceList[k]); } ResourceList[i].resourceList.Clear(); } } } CreatePrefabsList.Clear(); System.GC.Collect(); Resources.UnloadUnusedAssets(); }