static void MoveAssetBundle() { string streamingAssetsPath = Application.streamingAssetsPath; BMEditUtility.DelFolder(streamingAssetsPath); if (!Directory.Exists(streamingAssetsPath)) { Directory.CreateDirectory(streamingAssetsPath); } BMEditUtility.CopyDir(Output_Path, streamingAssetsPath); Logger.Log("Move all bundle files over. to " + streamingAssetsPath); }
//======================= // 流程函数 //======================= public static void StartBuild(bool forceBuild, Language language, BuildTarget buildTag, bool generate, bool luaEncoded, bool moveBundle) { buildTarget = buildTag; buildStartTime = EditorApplication.timeSinceStartup; tempLuaPaths = new List <string>(); isForceBuild = forceBuild; isLuaEncoded = luaEncoded; //记录打包次数 string verStr = EditorPrefs.GetString(settings.AppName + BM_Build_Version, null); if (string.IsNullOrEmpty(verStr)) { version = new Version(0, 0, 0, 1); } else { version = new Version(verStr); version = new Version(version.Major, version.Minor, version.Build, version.Revision + 1); } buildInfoJson = new JsonData(); buildInfoJson["resDir"] = settings.resDir; buildInfoJson["platform"] = buildTarget.ToString(); buildInfoJson["suffix"] = settings.Suffix_Bundle; buildInfoJson["useHashName"] = settings.useHashName; buildInfoJson["language"] = language.ToString(); buildInfoJson["bundles"] = new JsonData(); ignoreSuffixs = settings.Ignore_Suffix.Split(','); ignoreFolders = settings.Ignore_Folder.Split(','); //强制打包时情况原来的目录 if (isForceBuild && Directory.Exists(Output_Path)) { BMEditUtility.DelFolder(Output_Path); } Directory.CreateDirectory(Output_Path); //清空控制台日志 Debug.ClearDeveloperConsole(); //清除AssetBundleName (这步可以不做) //RemoveAllAssetBundleName(); //获取所有Build信息 FetchAllBuildInfo(); //计算AssetBundle信息 CalcAssetBundleInfos(); //做增量过滤 if (!isForceBuild)//是否是强制重新Build { IncrementFilter(); } //生成AssetBundle if (generate) { GenerateAssetBundle(); } //计算Bundle文件大小 if (generate) { CalcBundleFileSize(); } //写入Bundle信息 SaveBundleInfo(); //清除manifest文件 if (settings.clearManifestFile) { ClearManifestFiles(); } //移动生成后的所有bundle文件 if (moveBundle) { MoveAssetBundle(); } Logger.Log("Generate Assets Bundle Over. time consuming:{0}s", EditorApplication.timeSinceStartup - buildStartTime); }