void NewPackage() { //自动保存设置文件 CreatePackageFile(); //生成资源路径文件 ResourcesConfigManager.CreateResourcesConfig(); //自动增加小版本号 VersionService.SmallVersion++; VersionService.CreateVersionFile(); //清除旧打包信息 ClearAssetBundlesName(); //自动设置打包信息 SetAssetsInfo(); //删除streaming下所有旧资源 if (Directory.Exists(Application.dataPath + "/StreamingAssets")) { FileTool.DeleteDirectory(Application.dataPath + "/StreamingAssets"); } else { FileTool.CreatPath(Application.dataPath + "/StreamingAssets"); } BuildPipeline.BuildAssetBundles(Application.dataPath + "/StreamingAssets/", BuildAssetBundleOptions.None, PackageService.GetTargetPlatform); //删除所有manifest文件 DeleteManifestFile(Application.dataPath + "/StreamingAssets/"); //清除旧打包信息 ClearAssetBundlesName(); }
private static void UpdateAsset(List <string> paths) { bool isUpdate = false; if (paths == null) { isUpdate = true; } else { foreach (var item in paths) { if (item.Contains("Assets/Resources")) { isUpdate = true; break; } } } if (isUpdate) { if (ResourcesConfigManager.GetIsExistResources()) { ResourcesConfigManager.CreateResourcesConfig(); ResourcesConfigManager.ClearConfig(); AssetDatabase.Refresh(); Debug.Log("创建资源路径文件"); } } }
void PackageGUI() { GUILayout.Space(10); if (GUILayout.Button("生成资源路径文件")) { ResourcesConfigManager.CreateResourcesConfig(); } if (GUILayout.Button("生成 AssetsBundle 设置")) { PackageService.SetAssetBundlesName(); } if (GUILayout.Button("清除 AssetsBundle 设置")) { PackageService.ClearAssetBundlesName(); } GUILayout.Space(10); deleteManifestFile = GUILayout.Toggle(deleteManifestFile, "打包后删除清单文件"); if (GUILayout.Button("5.0 打包")) { PackageService.Package_5_0(deleteManifestFile); } }
public void AddResEndSave() { bundles.Clear(); ArrangeBundlesByLayer(); AddAllResourceBundle(); //添加资源文件 ArrangeBundlesByLayer(); //整理资源路径 CreatePackageFile(); //保存编辑器文件 CheckAndCreatBundelPackageConfig(); //生成资源路径文件 ResourcesConfigManager.CreateResourcesConfig(); //生成游戏用路径文件 ResourcesConfigManager.ClearConfig(); }
void PackageGUI() { GUILayout.Space(10); if (GUILayout.Button("生成资源路径文件")) { ResourcesConfigManager.CreateResourcesConfig(); } if (GUILayout.Button("生成 AssetsBundle 设置")) { long start = DateTime.Now.Ticks; Debug.Log("生成 AssetsBundle 设置=>"); PackageService.SetAssetBundlesName(); Debug.Log("结束,用时:" + ((DateTime.Now.Ticks - start) / 10000 / 1000f) + "s"); } //if (GUILayout.Button("生成 AssetsBundle 设置 New")) //{ // long start = DateTime.Now.Ticks; // Debug.Log("生成 AssetsBundle 设置New=>"); // PackageService.SetAllResourceBundleName("Assets/Resources/",null); // Debug.Log("结束,用时:" + ((DateTime.Now.Ticks - start) / 10000 / 1000f) + "s"); //} if (GUILayout.Button("清除 AssetsBundle 设置")) { long start = DateTime.Now.Ticks; Debug.Log("清除 AssetsBundle 设置=>"); PackageService.ClearAssetBundlesName(); Debug.Log("结束,用时:" + ((DateTime.Now.Ticks - start) / 10000 / 1000f) + "s"); } if (GUILayout.Button("清除并重新生成 AssetsBundle 设置")) { PackageService.ClearAssetBundlesName(); PackageService.SetAssetBundlesName(); } GUILayout.Space(10); deleteManifestFile = GUILayout.Toggle(deleteManifestFile, "打包后删除清单文件"); if (GUILayout.Button("5.0 打包")) { PackageService.Package_5_0(deleteManifestFile); } }
void OnGUI() { titleContent.text = "打包设置编辑器"; UpdateRelyPackageNames(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("过滤器:"); RelyMaskFilter = EditorGUILayout.MaskField(RelyMaskFilter, RelyPackageNames); bundleQuery = EditorGUILayout.TextField("", bundleQuery); EditorGUILayout.EndHorizontal(); scrollPos = GUILayout.BeginScrollView(scrollPos, GUILayout.ExpandHeight(false)); isFoldRelyPackages = EditorGUILayout.Foldout(isFoldRelyPackages, "依赖包:"); if (isFoldRelyPackages) { //依赖包视图 RelyPackagesView(); EditorGUILayout.Space(); } EditorGUI.indentLevel = 0; isFoldBundles = EditorGUILayout.Foldout(isFoldBundles, "AssetsBundle:"); if (isFoldBundles) { //bundle包视图 BundlesView(); } GUILayout.EndScrollView(); LogsScrollPos = GUILayout.BeginScrollView(LogsScrollPos, GUILayout.ExpandHeight(true)); EditorGUI.indentLevel = 0; isFoldLog = EditorGUILayout.Foldout(isFoldLog, "提示信息:"); if (isFoldLog) { //提示信息视图 LogView(); } GUILayout.EndScrollView(); EditorGUI.indentLevel = 0; GUILayout.BeginHorizontal(); checkMaterial = EditorGUILayout.Toggle("检查材质球和贴图", checkMaterial); GUILayout.EndHorizontal(); HotUpdateConfigGUI(); if (GUILayout.Button("检查依赖关系")) { CheckPackage(); } if (GUILayout.Button("生成并保存编辑器文件")) { CreatePackageFile(); //保存编辑器文件 CheckAndCreatBundelPackageConfig(); //生成资源路径文件 } if (GUILayout.Button("重新生成资源路径文件")) { ResourcesConfigManager.CreateResourcesConfig(); } if (GUILayout.Button("Create Bundle Names")) { //自动设置打包信息 SetAssetsInfo(); } if (GUILayout.Button("5.0 打包")) { NewPackage(); } GUILayout.BeginHorizontal(); VersionService.LargeVersion = EditorGUILayout.IntField("large", VersionService.LargeVersion); VersionService.SmallVersion = EditorGUILayout.IntField("small", VersionService.SmallVersion); if (GUILayout.Button("保存版本文件")) { VersionService.CreateVersionFile(); } GUILayout.EndHorizontal(); if (isContent) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(messageContent); if (GUILayout.Button("关闭")) { isContent = false; messageContent = ""; } if (errorCount != 0 || warnCount != 0) { if (GUILayout.Button("清除")) { isContent = false; messageContent = ""; ClearCheckLog(); } } EditorGUILayout.EndHorizontal(); } if (isProgress) { EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUI.ProgressBar(new Rect(3, position.height - 22, position.width - 6, 18), progress, progressContent); } }
//生成游戏中使用的配置文件 public void CreatBundelPackageConfig() { ResourcesConfigManager.CreateResourcesConfig(); }