diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs
index 1d5e845..9c66058 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs
@@ -28,8 +28,10 @@ namespace YooAsset.Editor
Parameters = parameters;
PipelineOutputDirectory = AssetBundleBuilderHelper.MakePipelineOutputDirectory(parameters.OutputRoot, parameters.BuildTarget);
- if (parameters.DryRunBuild)
- PipelineOutputDirectory += "_DryRunBuild";
+ if (parameters.BuildMode == EBuildMode.DryRunBuild)
+ PipelineOutputDirectory += $"_{EBuildMode.DryRunBuild}";
+ else if(parameters.BuildMode == EBuildMode.FastRunBuild)
+ PipelineOutputDirectory += $"_{EBuildMode.FastRunBuild}";
}
///
@@ -51,7 +53,12 @@ namespace YooAsset.Editor
BuildAssetBundleOptions opt = BuildAssetBundleOptions.None;
opt |= BuildAssetBundleOptions.StrictMode; //Do not allow the build to succeed if any errors are reporting during it.
- if (Parameters.DryRunBuild)
+ if (Parameters.BuildMode == EBuildMode.FastRunBuild)
+ {
+ throw new Exception("Should never get here !");
+ }
+
+ if (Parameters.BuildMode == EBuildMode.DryRunBuild)
{
opt |= BuildAssetBundleOptions.DryRunBuild;
return opt;
@@ -62,7 +69,7 @@ namespace YooAsset.Editor
else if (Parameters.CompressOption == ECompressOption.LZ4)
opt |= BuildAssetBundleOptions.ChunkBasedCompression;
- if (Parameters.ForceRebuild)
+ if (Parameters.BuildMode == EBuildMode.ForceRebuild)
opt |= BuildAssetBundleOptions.ForceRebuildAssetBundle; //Force rebuild the asset bundles
if (Parameters.AppendHash)
opt |= BuildAssetBundleOptions.AppendHashToAssetBundleName; //Append the hash to the assetBundle name
@@ -125,11 +132,16 @@ namespace YooAsset.Editor
new TaskCopyBuildinFiles(), //拷贝内置文件
};
+ if (buildParameters.BuildMode == EBuildMode.FastRunBuild)
+ BuildRunner.EnableLog = false;
+ else
+ BuildRunner.EnableLog = true;
+
bool succeed = BuildRunner.Run(pipeline, _buildContext);
if (succeed)
- Debug.Log($"构建成功!");
+ Debug.Log($"{buildParameters.BuildMode}模式构建成功!");
else
- Debug.LogWarning($"构建失败!");
+ Debug.LogWarning($"{buildParameters.BuildMode}模式构建失败!");
return succeed;
}
}
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs
index 9f11e5f..47593da 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs
@@ -10,6 +10,16 @@ namespace YooAsset.Editor
///
public int BuildVersion = 0;
+ ///
+ /// 构建模式
+ ///
+ public EBuildMode BuildMode = EBuildMode.ForceRebuild;
+
+ ///
+ /// 内置资源标签
+ ///
+ public string BuildTags = string.Empty;
+
///
/// 压缩方式
///
@@ -24,20 +34,5 @@ namespace YooAsset.Editor
/// 附加后缀格式
///
public bool AppendExtension = false;
-
- ///
- /// 强制构建
- ///
- public bool ForceRebuild = false;
-
- ///
- /// 演练构建
- ///
- public bool DryRunBuild = false;
-
- ///
- /// 内置标签
- ///
- public string BuildTags = string.Empty;
}
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs
index 6e87bf9..ea76a1e 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs
@@ -22,15 +22,13 @@ namespace YooAsset.Editor
private List _encryptionServicesClassTypes;
private List _encryptionServicesClassNames;
- private TextField _buildOutputTxt;
+ private TextField _buildOutputField;
private IntegerField _buildVersionField;
- private EnumField _compressionField;
+ private EnumField _buildModeField;
+ private TextField _buildTagsField;
private PopupField _encryptionField;
+ private EnumField _compressionField;
private Toggle _appendExtensionToggle;
- private Toggle _forceRebuildToggle;
- private Toggle _dryRunBuildToggle;
- private TextField _buildTagsTxt;
-
public void CreateGUI()
{
@@ -56,9 +54,9 @@ namespace YooAsset.Editor
// 输出目录
string defaultOutputRoot = AssetBundleBuilderHelper.GetDefaultOutputRoot();
string pipelineOutputDirectory = AssetBundleBuilderHelper.MakePipelineOutputDirectory(defaultOutputRoot, _buildTarget);
- _buildOutputTxt = root.Q("BuildOutput");
- _buildOutputTxt.SetValueWithoutNotify(pipelineOutputDirectory);
- _buildOutputTxt.SetEnabled(false);
+ _buildOutputField = root.Q("BuildOutput");
+ _buildOutputField.SetValueWithoutNotify(pipelineOutputDirectory);
+ _buildOutputField.SetEnabled(false);
// 构建版本
_buildVersionField = root.Q("BuildVersion");
@@ -68,34 +66,33 @@ namespace YooAsset.Editor
AssetBundleBuilderSettingData.Setting.BuildVersion = _buildVersionField.value;
});
- // 压缩方式
- _compressionField = root.Q("Compression");
- _compressionField.Init(AssetBundleBuilderSettingData.Setting.CompressOption);
- _compressionField.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.CompressOption);
- _compressionField.style.width = 300;
- _compressionField.SetEnabled(AssetBundleBuilderSettingData.Setting.DryRunBuild == false);
- _compressionField.RegisterValueChangedCallback(evt =>
+ // 构建模式
+ _buildModeField = root.Q("BuildMode");
+ _buildModeField.Init(AssetBundleBuilderSettingData.Setting.BuildMode);
+ _buildModeField.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.BuildMode);
+ _buildModeField.style.width = 300;
+ _buildModeField.RegisterValueChangedCallback(evt =>
{
- AssetBundleBuilderSettingData.Setting.CompressOption = (ECompressOption)_compressionField.value;
+ AssetBundleBuilderSettingData.Setting.BuildMode = (EBuildMode)_buildModeField.value;
+ RefreshWindow();
+ });
+
+ // 内置资源标签
+ _buildTagsField = root.Q("BuildinTags");
+ _buildTagsField.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.BuildTags);
+ _buildTagsField.RegisterValueChangedCallback(evt =>
+ {
+ AssetBundleBuilderSettingData.Setting.BuildTags = _buildTagsField.value;
});
// 加密方法
var encryptionContainer = root.Q("EncryptionContainer");
if (_encryptionServicesClassNames.Count > 0)
{
- int defaultIndex = 0;
- for (int index = 0; index < _encryptionServicesClassNames.Count; index++)
- {
- if (_encryptionServicesClassNames[index] == AssetBundleBuilderSettingData.Setting.EncyptionClassName)
- {
- defaultIndex = index;
- break;
- }
- }
+ int defaultIndex = GetEncryptionDefaultIndex(AssetBundleBuilderSettingData.Setting.EncyptionClassName);
_encryptionField = new PopupField(_encryptionServicesClassNames, defaultIndex);
_encryptionField.label = "Encryption";
_encryptionField.style.width = 300;
- _encryptionField.SetEnabled(AssetBundleBuilderSettingData.Setting.DryRunBuild == false);
_encryptionField.RegisterValueChangedCallback(evt =>
{
AssetBundleBuilderSettingData.Setting.EncyptionClassName = _encryptionField.value;
@@ -107,53 +104,32 @@ namespace YooAsset.Editor
_encryptionField = new PopupField();
_encryptionField.label = "Encryption";
_encryptionField.style.width = 300;
- _encryptionField.SetEnabled(AssetBundleBuilderSettingData.Setting.DryRunBuild == false);
encryptionContainer.Add(_encryptionField);
}
+ // 压缩方式
+ _compressionField = root.Q("Compression");
+ _compressionField.Init(AssetBundleBuilderSettingData.Setting.CompressOption);
+ _compressionField.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.CompressOption);
+ _compressionField.style.width = 300;
+ _compressionField.RegisterValueChangedCallback(evt =>
+ {
+ AssetBundleBuilderSettingData.Setting.CompressOption = (ECompressOption)_compressionField.value;
+ });
+
// 附加后缀格式
_appendExtensionToggle = root.Q("AppendExtension");
_appendExtensionToggle.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.AppendExtension);
- _appendExtensionToggle.SetEnabled(AssetBundleBuilderSettingData.Setting.DryRunBuild == false);
_appendExtensionToggle.RegisterValueChangedCallback(evt =>
{
AssetBundleBuilderSettingData.Setting.AppendExtension = _appendExtensionToggle.value;
});
- // 强制构建
- _forceRebuildToggle = root.Q("ForceRebuild");
- _forceRebuildToggle.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.ForceRebuild);
- _forceRebuildToggle.SetEnabled(AssetBundleBuilderSettingData.Setting.DryRunBuild == false);
- _forceRebuildToggle.RegisterValueChangedCallback(evt =>
- {
- AssetBundleBuilderSettingData.Setting.ForceRebuild = _forceRebuildToggle.value;
- _buildTagsTxt.SetEnabled(_forceRebuildToggle.value);
- });
-
- // 演练构建
- _dryRunBuildToggle = root.Q("DryRunBuild");
- _dryRunBuildToggle.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.DryRunBuild);
- _dryRunBuildToggle.RegisterValueChangedCallback(evt =>
- {
- AssetBundleBuilderSettingData.Setting.DryRunBuild = _dryRunBuildToggle.value;
- _compressionField.SetEnabled(_dryRunBuildToggle.value == false);
- _encryptionField.SetEnabled(_dryRunBuildToggle.value == false);
- _appendExtensionToggle.SetEnabled(_dryRunBuildToggle.value == false);
- _forceRebuildToggle.SetEnabled(_dryRunBuildToggle.value == false);
- });
-
- // 内置标签
- _buildTagsTxt = root.Q("BuildinTags");
- _buildTagsTxt.SetEnabled(_forceRebuildToggle.value);
- _buildTagsTxt.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.BuildTags);
- _buildTagsTxt.RegisterValueChangedCallback(evt =>
- {
- AssetBundleBuilderSettingData.Setting.BuildTags = _buildTagsTxt.value;
- });
-
// 构建按钮
var buildButton = root.Q