public static T[] LoadAll <T>(string bundleName) where T : Object
{
#if UNITY_EDITOR
if (UseAssetDatabase)
{
EnsureAssetDatabase();
var assets = s_EditorAssetMap.GetAssetPaths(bundleName);
if (assets.Length == 0)
{
return(new T[0]);
}
var typeExpected = typeof(T);
var foundList = new List <T>(assets.Length);
for (int i = 0; i < assets.Length; i++)
{
var loaded = UnityEditor.AssetDatabase.LoadAssetAtPath <T>(assets[i]);
if (loaded == null)
{
continue;
}
foundList.Add(loaded);
}
return(foundList.ToArray());
}
#endif
if (!Initialized)
{
throw new System.Exception("BundleManager not initialized, try initialize first!");
}
if (!s_AssetBundles.TryGetValue(bundleName, out var foundBundle))
{
return(new T[0]);
}
var loadedAssets = foundBundle.Bundle.LoadAllAssets <T>();
TrackObjectsInternal(loadedAssets, foundBundle);
return(loadedAssets);
}