/// <summary> /// 设置目标目录的打包类型 /// </summary> /// <param name="buildType"></param> private static void SetTargetDirAtildType(AssetBundleBuildType buildType) { var projectInfo = ProjectInfoDati.GetActualInstance(); var assetbundleEditor = AssetBundleEditorDati.GetActualInstance(); locAppId = projectInfo.DevelopProjectName; if (string.IsNullOrEmpty(locAppId)) { UnityEditorUtility.DisplayError("未设置项目名称"); return; } //appHelper = locU3DApp.Helper; if (assetbundleEditor == null) { Debug.LogError($"项目的 AssetBundleSetting 实例未创建 !"); return; } var dirs = UnityEditorUtility.GetSelectDirs(); foreach (var dir in dirs) { if (!dir.StartsWith(projectInfo.ProjectAssetDatabaseDir)) { Debug.LogError($"目标目录不是一个有效的AssetBundle打包目录!"); return; } assetbundleEditor.SetBuildAtTargetBuildType(dir, buildType); if (buildType == AssetBundleBuildType.BuildAtDirTree) // 清理所有子目录的打包配置 { var sonDirs = IOUtility.GetAllDir(dir, null, true, false); foreach (var sonDir in sonDirs) { assetbundleEditor.CleanBuildSettingAtDir(sonDir); } Debug.Log($"目录{dir}已设置为目录树打包,其所有子目录的打包配置都已被清空!"); } } AssetBundleEditorDati.GetSingleDati().Save(); }
private static void CleanSelectDir() { var dirs = UnityEditorUtility.GetSelectDirs(); var targetApp = UnityEditorUtility.TryGetLocProjectInfoAtDir(dirs.First()); if (targetApp == null) { UnityEditorUtility.DisplayError($"第一个目录必须是一个应用的允许打包目录!"); return; } var assetbundleEditor = AssetBundleEditorDati.GetActualInstance(); foreach (var dir in dirs) { //var dirSetting = appAssetBundleSetting.GetDirSetting(dir); //List<String> paths = null; //paths = dirSetting?.GetFullPathsAtDirTree(); //assetbundleEditor.CleanBuildSettingAtDir(dir, paths); } AssetBundleEditorDati.GetSingleDati().Save(); }