public IObjectInfo Load(string path, System.Type type) { path = PathFormat(path, type); #if UNITY_EDITOR if (Env.DebugLevel == DebugLevels.Auto || Env.DebugLevel == DebugLevels.Dev) { return(new DefaultObjectInfo(UnityEditor.AssetDatabase.LoadAssetAtPath("Assets" + Env.ResourcesBuildPath + Path.AltDirectorySeparatorChar + path, type))); } #endif IObjectInfo hosted; if (resourcesHosted != null) { hosted = resourcesHosted.Get(path); if (hosted != null) { return(hosted); } } Object obj = assetBundleLoader.LoadAsset(path); if (resourcesHosted != null) { hosted = resourcesHosted.Hosted(path, obj); } else { hosted = new DefaultObjectInfo(obj); } return(hosted); }
public UnityEngine.Coroutine LoadAllAsync(string path, System.Action <IObjectInfo[]> callback) { #if UNITY_EDITOR if (Env.DebugLevel == DebugLevels.Auto || Env.DebugLevel == DebugLevels.Dev) { throw new System.Exception("not support [LoadAllAsync] in auto env"); } #endif return(assetBundleLoader.LoadAssetAllAsync(path, (objs) => { IObjectInfo[] hosted = new IObjectInfo[objs.Length]; for (int i = 0; i < objs.Length; i++) { hosted[i] = new DefaultObjectInfo(objs[i]); } callback(hosted); })); }
public IObjectInfo[] LoadAll(string path) { #if UNITY_EDITOR if (Env.DebugLevel == DebugLevels.Auto || Env.DebugLevel == DebugLevels.Dev) { throw new System.Exception("not support [LoadAll] in auto env"); } #endif Object[] objs = assetBundleLoader.LoadAssetAll(path); IObjectInfo[] hosted = new IObjectInfo[objs.Length]; for (int i = 0; i < objs.Length; i++) { hosted[i] = new DefaultObjectInfo(objs[i]); } return(hosted); }
public UnityEngine.Coroutine LoadAsync(string path, System.Type type, System.Action <IObjectInfo> callback) { path = PathFormat(path, type); #if UNITY_EDITOR if (Env.DebugLevel == DebugLevels.Auto || Env.DebugLevel == DebugLevels.Dev) { return(App.StartCoroutine(EmptyIEnumerator(() => { callback(new DefaultObjectInfo(UnityEditor.AssetDatabase.LoadAssetAtPath("Assets" + Env.ResourcesBuildPath + Path.AltDirectorySeparatorChar + path, type))); }))); } #endif IObjectInfo hosted; if (resourcesHosted != null) { hosted = resourcesHosted.Get(path); if (hosted != null) { return(App.StartCoroutine(EmptyIEnumerator(() => { callback(hosted); }))); } } return(assetBundleLoader.LoadAssetAsync(PathFormat(path, type), (obj) => { if (resourcesHosted != null) { hosted = resourcesHosted.Hosted(path, obj); } else { hosted = new DefaultObjectInfo(obj); } callback(hosted); })); }