2using System.Collections;
3using System.Collections.Generic;
15 Dictionary<string, GameObject> lookup =
new Dictionary<string, GameObject>();
25 foreach(
string resourceFolder
in pb_Config.Resource_Folder_Paths)
27 GameObject[] prefabs = Resources.LoadAll(resourceFolder).Select(x => x is GameObject ? (GameObject)x :
null).Where(y => y !=
null).ToArray();
30 System.Text.StringBuilder sb =
new System.Text.StringBuilder();
31 sb.AppendLine(
"Loaded Resources: ");
35 for(
int i = 0; i < prefabs.Length; i++)
38 sb.AppendLine(
string.Format(
"{0,-50} : {1}", prefabs[i].name, prefabs[i].GetComponent<pb_MetaDataComponent>().metadata.fileId) );
40 lookup.Add(prefabs[i].GetComponent<pb_MetaDataComponent>().metadata.fileId, prefabs[i]);
44 Debug.Log(sb.ToString());
47 Resources.UnloadUnusedAssets();
53 if(
string.IsNullOrEmpty(fileId) )
56 GameObject obj =
null;
72 Debug.LogWarning(
"Attempting to load instance asset through resource manager.");
86 Debug.LogWarning(
"Resource manager could not find \"" + metadata.
fileId +
"\" in loaded resources.");
98 Debug.LogError(
"File not found from metadata: " + metadata);
109 List<T> assets =
new List<T>();
111 foreach(
string path
in pb_Config.Resource_Folder_Paths)
113 assets.AddRange( Resources.LoadAll<T>(path) );
116 foreach(
string bundleName
in pb_Config.AssetBundle_Names)
121 assets.AddRange( bundle.LoadAllAssets<T>() );
static AssetBundle LoadAssetBundleWithName(string name)
static GameObject LoadPrefabWithId(string fileId)
static IEnumerable< T > LoadAll< T >()
static GameObject LoadPrefabWithMetadata(pb_MetaData metadata)