/// <summary> /// 加载函数(单个:异步). /// </summary> /// <param name="iPath">路径.</param> /// <param name="iLoadCompleted">加载成功回调函数</param> public static IEnumerator LoadAsync <T>(string iPath, System.Action <bool, string, AssetBundleType, T> iLoadCompleted) where T : Object { #if BUILD_DEBUG yield return(ResourcesLoad.LoadAsync <T>( iPath, iLoadCompleted, RetryLoadAssetBundles <T>)); #else yield return(AssetBundlesManager.Instance.LoadFromAssetBundleAsync <T>( iPath, iLoadCompleted, RetryLoadAssetBundles <T>)); #endif yield return(new WaitForEndOfFrame()); }
/// <summary> /// 加载重试. /// </summary> /// <param name="iPath">路径.</param> /// <param name="iLoadCompleted">加载成功回调函数.</param> private static IEnumerator RetryLoadAssetBundles <T>( string iPath, System.Action <bool, string, AssetBundleType, T> iLoadCompleted) where T : Object { #if BUILD_DEBUG // 切换路径 Default -> Develop string _assetPath = Const.SwitchPathToDevelop(iPath); yield return(AssetBundlesManager.Instance.LoadFromAssetBundleAsync <T>( _assetPath, iLoadCompleted, null)); #else // 切换路径 Develop -> Default var path = Const.SwitchPathToDefault(iPath); yield return(ResourcesLoad.LoadAsync <T>(path, iLoadCompleted, null)); yield return(new WaitForEndOfFrame()); #endif }