private static void CleanAllSonDir() { locAppId = UnityEditorUtility.GetLocAppIdAtSelectDir(); locU3DApp = ProjectInfoDati.GetActualInstance(); if (string.IsNullOrEmpty(locAppId)) { UnityEditorUtility.DisplayError("所选择的目录不是一个应用下的有效目录!"); return; } var assetbundleEditor = AssetBundleEditorDati.GetActualInstance(); if (assetbundleEditor == null) { UnityEditorUtility.DisplayError($"应用{locAppId}没有AssetBundle打包配置!"); throw new Exception($"应用{locAppId}没有AssetBundle打包配置!"); } foreach (var dir in AllSonDirs) { if (!dir.StartsWith(locU3DApp.ProjectAssetDatabaseDir)) // dir.StartsWith(appHelper.StreamingAssetsDir)) { Debug.LogError($"目标目录不是一个有效的AssetBundle打包目录!"); continue; } assetbundleEditor.CleanBuildSettingAtDir(dir); } AssetBundleEditorDati.GetSingleDati().Save(); }
private static void SetSonDirAtildType(AssetBundleBuildType buildType, List <string> dirs) { locAppId = UnityEditorUtility.GetLocAppIdAtSelectDir(); locU3DApp = ProjectInfoDati.GetActualInstance(); if (string.IsNullOrEmpty(locAppId)) { UnityEditorUtility.DisplayError("所选择的目录不是一个应用下的有效目录!"); return; } foreach (var dir in dirs) { if (!dir.StartsWith(locU3DApp.ProjectAssetDatabaseDir)) //&& dir.StartsWith(appHelper.StreamingAssetsDir)) { Debug.LogError($"目标目录不是一个有效的AssetBundle打包目录!"); continue; } var assetbundleEditor = AssetBundleEditorDati.GetActualInstance(); if (assetbundleEditor == null) { Debug.Log($"应用{locAppId}没有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(); }
public void SetBuildAtTargetBuildType(string dir, AssetBundleBuildType buildType) { var locAppId = UnityEditorUtility.GetLocAppIdAtSelectDir(); var appSetting = ProjectInfoDati.GetActualInstance(); if (locAppId == null) { Debug.LogError($"目标目录{dir}不是一个应用下的目录!"); return; } if (!AssetBundleBuilder.IsLegalAssetBundleDir(dir)) { Debug.LogError($"目标目录{dir}不是一个有效的AssetBundle目录!"); return; } var existSetting = BundleDirSettings.Find(s => s.Dir == dir); if (existSetting == null) { existSetting = new AssetBundleBuildSetting { BuildType = buildType, Dir = dir, //LocAppId = Unity3DEditorUtility.GetLocAppIdAtSelectDir() }; BundleDirSettings.Add(existSetting); BundleDirSettings = BundleDirSettings.OrderBy(s => s.Dir).ToList(); Debug.Log($"目录{dir}当前不存在配置数据,已新建配置!"); } else { existSetting.BuildType = buildType; Debug.Log($"目录{dir}已设置为基于{buildType}打包方式!"); } }