/// <summary> /// 初始化 /// </summary> /// <param name="rootPath"></param> public void Init(string rootPath, RuntimePlatform platform = RuntimePlatform.Android) { //多热更切换,需要卸载 if (this.AssetConfigLoder != null) { this.UnloadAllAsset(); } //平台 string platformPath = ""; //1.设置加载路径 if (Application.isEditor) { //editor下可以自行输入 platformPath = BApplication.GetPlatformPath(platform); firstArtDirectory = IPath.Combine(rootPath, platformPath, BResources.ART_ASSET_ROOT_PATH); secArtDirectory = IPath.Combine(Application.streamingAssetsPath, platformPath, BResources.ART_ASSET_ROOT_PATH); // } else { //runtime只能使用当前平台 platformPath = BApplication.GetRuntimePlatformPath(); firstArtDirectory = IPath.Combine(Application.persistentDataPath, platformPath, BResources.ART_ASSET_ROOT_PATH); secArtDirectory = IPath.Combine(Application.streamingAssetsPath, platformPath, BResources.ART_ASSET_ROOT_PATH); // rootPath = Application.persistentDataPath; } //2.寻址路径格式化 firstArtDirectory = IPath.FormatPathOnRuntime(firstArtDirectory); secArtDirectory = IPath.FormatPathOnRuntime(secArtDirectory); //3.加载ArtConfig this.AssetConfigLoder = GetAssetbundleConfigLoder(rootPath, platformPath); //开始异步任务刷新 IEnumeratorTool.StartCoroutine(this.IE_LoadTaskUpdate()); IEnumeratorTool.StartCoroutine(this.IE_UnLoadTaskUpdate()); BDebug.Log($"【AssetBundleV2】 firstDir:{firstArtDirectory}", "red"); BDebug.Log($"【AssetBundleV2】 secDir:{secArtDirectory}", "red"); }