diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs
index 5680f3a..83e475b 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs
@@ -8,94 +8,6 @@ namespace YooAsset.Editor
{
public class AssetBundleBuilder
{
- ///
- /// 构建参数
- ///
- public class BuildParameters
- {
- ///
- /// 是否验证构建结果
- ///
- public bool IsVerifyBuildingResult = false;
-
- ///
- /// 输出的根目录
- ///
- public string OutputRoot;
-
- ///
- /// 构建的平台
- ///
- public BuildTarget BuildTarget;
-
- ///
- /// 构建的版本(资源版本号)
- ///
- public int BuildVersion;
-
- ///
- /// 是否允许冗余机制
- /// 说明:冗余机制可以帮助我们减少包体数量
- ///
- public bool ApplyRedundancy = false;
-
- ///
- /// 是否附加上文件扩展名
- ///
- public bool AppendFileExtension = false;
-
-
- ///
- /// 压缩选项
- ///
- public ECompressOption CompressOption;
-
- ///
- /// 是否强制重新构建整个项目,如果为FALSE则是增量打包
- ///
- public bool IsForceRebuild;
-
- ///
- /// 内置资源的标记列表
- /// 注意:分号为分隔符
- ///
- public string BuildinTags;
-
- #region 高级选项
- ///
- /// 文件名附加上哈希值
- ///
- public bool IsAppendHash = false;
-
- ///
- /// 禁止写入类型树结构(可以降低包体和内存并提高加载效率)
- ///
- public bool IsDisableWriteTypeTree = false;
-
- ///
- /// 忽略类型树变化
- ///
- public bool IsIgnoreTypeTreeChanges = true;
-
- ///
- /// 禁用名称查找资源(可以降内存并提高加载效率)
- ///
- public bool IsDisableLoadAssetByFileName = false;
- #endregion
-
-
- ///
- /// 获取内置标记列表
- ///
- public List GetBuildinTags()
- {
- return StringUtility.StringToStringList(BuildinTags, ';');
- }
- }
-
- ///
- /// 构建参数环境
- ///
public class BuildParametersContext : IContextObject
{
///
@@ -139,15 +51,15 @@ namespace YooAsset.Editor
else if (Parameters.CompressOption == ECompressOption.LZ4)
opt |= BuildAssetBundleOptions.ChunkBasedCompression;
- if (Parameters.IsForceRebuild)
+ if (Parameters.ForceRebuild)
opt |= BuildAssetBundleOptions.ForceRebuildAssetBundle; //Force rebuild the asset bundles
- if (Parameters.IsAppendHash)
+ if (Parameters.AppendHash)
opt |= BuildAssetBundleOptions.AppendHashToAssetBundleName; //Append the hash to the assetBundle name
- if (Parameters.IsDisableWriteTypeTree)
+ if (Parameters.DisableWriteTypeTree)
opt |= BuildAssetBundleOptions.DisableWriteTypeTree; //Do not include type information within the asset bundle (don't write type tree).
- if (Parameters.IsIgnoreTypeTreeChanges)
+ if (Parameters.IgnoreTypeTreeChanges)
opt |= BuildAssetBundleOptions.IgnoreTypeTreeChanges; //Ignore the type tree changes when doing the incremental build check.
- if (Parameters.IsDisableLoadAssetByFileName)
+ if (Parameters.DisableLoadAssetByFileName)
{
opt |= BuildAssetBundleOptions.DisableLoadAssetByFileName; //Disables Asset Bundle LoadAsset by file name.
opt |= BuildAssetBundleOptions.DisableLoadAssetByFileNameWithExtension; //Disables Asset Bundle LoadAsset by file name with extension.
@@ -157,7 +69,6 @@ namespace YooAsset.Editor
}
}
-
private readonly BuildContext _buildContext = new BuildContext();
///
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs
index 9731285..4235da2 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs
@@ -28,8 +28,8 @@ namespace YooAsset.Editor
private int _buildVersion;
private BuildTarget _buildTarget;
private ECompressOption _compressOption = ECompressOption.Uncompressed;
- private bool _isAppendExtension = false;
- private bool _isForceRebuild = false;
+ private bool _appendExtension = false;
+ private bool _forceRebuild = false;
private string _buildinTags = string.Empty;
// GUI相关
@@ -54,9 +54,9 @@ namespace YooAsset.Editor
// 构建参数
_buildVersion = EditorGUILayout.IntField("Build Version", _buildVersion, GUILayout.MaxWidth(250));
_compressOption = (ECompressOption)EditorGUILayout.EnumPopup("Compression", _compressOption, GUILayout.MaxWidth(250));
- _isAppendExtension = GUILayout.Toggle(_isAppendExtension, "Append Extension", GUILayout.MaxWidth(120));
- _isForceRebuild = GUILayout.Toggle(_isForceRebuild, "Force Rebuild", GUILayout.MaxWidth(120));
- if (_isForceRebuild)
+ _appendExtension = GUILayout.Toggle(_appendExtension, "Append Extension", GUILayout.MaxWidth(120));
+ _forceRebuild = GUILayout.Toggle(_forceRebuild, "Force Rebuild", GUILayout.MaxWidth(120));
+ if (_forceRebuild)
_buildinTags = EditorGUILayout.TextField("Buildin Tags", _buildinTags);
// 构建按钮
@@ -65,7 +65,7 @@ namespace YooAsset.Editor
{
string title;
string content;
- if (_isForceRebuild)
+ if (_forceRebuild)
{
title = "警告";
content = "确定开始强制构建吗,这样会删除所有已有构建的文件";
@@ -114,22 +114,22 @@ namespace YooAsset.Editor
private void ExecuteBuild()
{
string defaultOutputRoot = AssetBundleBuilderHelper.GetDefaultOutputRoot();
- AssetBundleBuilder.BuildParameters buildParameters = new AssetBundleBuilder.BuildParameters();
- buildParameters.IsVerifyBuildingResult = true;
+ BuildParameters buildParameters = new BuildParameters();
+ buildParameters.VerifyBuildingResult = true;
buildParameters.OutputRoot = defaultOutputRoot;
buildParameters.BuildTarget = _buildTarget;
buildParameters.BuildVersion = _buildVersion;
buildParameters.CompressOption = _compressOption;
- buildParameters.AppendFileExtension = _isAppendExtension;
- buildParameters.IsForceRebuild = _isForceRebuild;
+ buildParameters.AppendFileExtension = _appendExtension;
+ buildParameters.ForceRebuild = _forceRebuild;
buildParameters.BuildinTags = _buildinTags;
_assetBuilder.Run(buildParameters);
}
#region 配置相关
private const string StrEditorCompressOption = "StrEditorCompressOption";
- private const string StrEditorIsAppendExtension = "StrEditorIsAppendExtension";
- private const string StrEditorIsForceRebuild = "StrEditorIsForceRebuild";
+ private const string StrEditorAppendExtension = "StrEditorAppendExtension";
+ private const string StrEditorForceRebuild = "StrEditorForceRebuild";
private const string StrEditorBuildinTags = "StrEditorBuildinTags";
///
@@ -138,8 +138,8 @@ namespace YooAsset.Editor
private void SaveSettingsToPlayerPrefs()
{
EditorTools.PlayerSetEnum(StrEditorCompressOption, _compressOption);
- EditorPrefs.SetBool(StrEditorIsAppendExtension, _isAppendExtension);
- EditorPrefs.SetBool(StrEditorIsForceRebuild, _isForceRebuild);
+ EditorPrefs.SetBool(StrEditorAppendExtension, _appendExtension);
+ EditorPrefs.SetBool(StrEditorForceRebuild, _forceRebuild);
EditorPrefs.SetString(StrEditorBuildinTags, _buildinTags);
}
@@ -149,8 +149,8 @@ namespace YooAsset.Editor
private void LoadSettingsFromPlayerPrefs()
{
_compressOption = EditorTools.PlayerGetEnum(StrEditorCompressOption, ECompressOption.Uncompressed);
- _isAppendExtension = EditorPrefs.GetBool(StrEditorIsAppendExtension, false);
- _isForceRebuild = EditorPrefs.GetBool(StrEditorIsForceRebuild, false);
+ _appendExtension = EditorPrefs.GetBool(StrEditorAppendExtension, false);
+ _forceRebuild = EditorPrefs.GetBool(StrEditorForceRebuild, false);
_buildinTags = EditorPrefs.GetString(StrEditorBuildinTags, string.Empty);
}
#endregion
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs
new file mode 100644
index 0000000..5574669
--- /dev/null
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs
@@ -0,0 +1,89 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEditor;
+
+namespace YooAsset.Editor
+{
+ ///
+ /// 构建参数
+ ///
+ public class BuildParameters
+ {
+ ///
+ /// 验证构建结果
+ ///
+ public bool VerifyBuildingResult = false;
+
+ ///
+ /// 输出的根目录
+ ///
+ public string OutputRoot;
+
+ ///
+ /// 构建的平台
+ ///
+ public BuildTarget BuildTarget;
+
+ ///
+ /// 构建的版本(资源版本号)
+ ///
+ public int BuildVersion;
+
+ ///
+ /// 启用自动分包机制
+ /// 说明:自动分包机制可以实现资源零冗余
+ ///
+ public bool EnableAutoCollect = true;
+
+ ///
+ /// 追加文件扩展名
+ ///
+ public bool AppendFileExtension = false;
+
+
+ ///
+ /// 强制重新构建整个项目,如果为FALSE则是增量打包
+ ///
+ public bool ForceRebuild;
+
+ ///
+ /// 内置资源的标记列表
+ /// 注意:分号为分隔符
+ ///
+ public string BuildinTags;
+
+ ///
+ /// 压缩选项
+ ///
+ public ECompressOption CompressOption;
+
+ ///
+ /// 文件名附加上哈希值
+ ///
+ public bool AppendHash = false;
+
+ ///
+ /// 禁止写入类型树结构(可以降低包体和内存并提高加载效率)
+ ///
+ public bool DisableWriteTypeTree = false;
+
+ ///
+ /// 忽略类型树变化
+ ///
+ public bool IgnoreTypeTreeChanges = true;
+
+ ///
+ /// 禁用名称查找资源(可以降内存并提高加载效率)
+ ///
+ public bool DisableLoadAssetByFileName = false;
+
+
+ ///
+ /// 获取内置标记列表
+ ///
+ public List GetBuildinTags()
+ {
+ return StringUtility.StringToStringList(BuildinTags, ';');
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs.meta b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs.meta
new file mode 100644
index 0000000..d2a2f3c
--- /dev/null
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 98bb314dc26ba184fbb9e9fdcdb58a1d
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/BuildReport.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/BuildReport.cs
index 0ae1492..f59e3df 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/BuildReport.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/BuildReport.cs
@@ -12,9 +12,9 @@ namespace YooAsset.Editor
public class BuildReport
{
///
- /// 构建汇总信息
+ /// 汇总信息
///
- public BuildSummary Summary = new BuildSummary();
+ public ReportSummary Summary = new ReportSummary();
///
/// 资源对象列表
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/BuildSummary.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/BuildSummary.cs
deleted file mode 100644
index 1eed88c..0000000
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/BuildSummary.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-using System;
-using UnityEditor;
-
-namespace YooAsset.Editor
-{
- [Serializable]
- public class BuildSummary
- {
- ///
- /// 引擎版本
- ///
- public string UnityVersion;
-
- ///
- /// 构建时间
- ///
- public string BuildTime;
-
- ///
- /// 构建耗时(单位:秒)
- ///
- public int BuildSeconds;
-
- ///
- /// 构建平台
- ///
- public BuildTarget BuildTarget;
-
- ///
- /// 构建版本
- ///
- public int BuildVersion;
-
- ///
- /// 是否开启冗余机制
- ///
- public bool ApplyRedundancy;
-
- ///
- /// 是否开启文件后缀名
- ///
- public bool AppendFileExtension;
-
- #region 着色器
- public bool IsCollectAllShaders;
- public string ShadersBundleName;
- #endregion
-
- #region 构建参数
- public bool IsForceRebuild;
- public string BuildinTags;
- public ECompressOption CompressOption;
- public bool IsAppendHash;
- public bool IsDisableWriteTypeTree;
- public bool IsIgnoreTypeTreeChanges;
- public bool IsDisableLoadAssetByFileName;
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportSummary.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportSummary.cs
new file mode 100644
index 0000000..92340a3
--- /dev/null
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportSummary.cs
@@ -0,0 +1,74 @@
+using System;
+using UnityEditor;
+
+namespace YooAsset.Editor
+{
+ [Serializable]
+ public class ReportSummary
+ {
+ ///
+ /// 引擎版本
+ ///
+ public string UnityVersion;
+
+ ///
+ /// 构建时间
+ ///
+ public string BuildTime;
+
+ ///
+ /// 构建耗时(单位:秒)
+ ///
+ public int BuildSeconds;
+
+ ///
+ /// 构建平台
+ ///
+ public BuildTarget BuildTarget;
+
+ ///
+ /// 构建版本
+ ///
+ public int BuildVersion;
+
+ ///
+ /// 启用自动分包机制
+ ///
+ public bool EnableAutoCollect;
+
+ ///
+ /// 追加文件扩展名
+ ///
+ public bool AppendFileExtension;
+
+ ///
+ /// 自动收集着色器
+ ///
+ public bool AutoCollectShaders;
+
+ ///
+ /// 自动收集的着色器资源包名
+ ///
+ public string ShadersBundleName;
+
+ // 构建参数
+ public bool ForceRebuild;
+ public string BuildinTags;
+ public ECompressOption CompressOption;
+ public bool AppendHash;
+ public bool DisableWriteTypeTree;
+ public bool IgnoreTypeTreeChanges;
+ public bool DisableLoadAssetByFileName;
+
+ // 构建结果
+ public int AssetFileTotalCount;
+ public int AllBundleTotalCount;
+ public long AllBundleTotalSize;
+ public int BuildinBundleTotalCount;
+ public long BuildinBundleTotalSize;
+ public int EncryptedBundleTotalCount;
+ public long EncryptedBundleTotalSize;
+ public int RawBundleTotalCount;
+ public long RawBundleTotalSize;
+ }
+}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/BuildSummary.cs.meta b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportSummary.cs.meta
similarity index 100%
rename from Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/BuildSummary.cs.meta
rename to Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportSummary.cs.meta
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskBuilding.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskBuilding.cs
index 9f1afcb..fef5142 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskBuilding.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskBuilding.cs
@@ -45,7 +45,7 @@ namespace YooAsset.Editor
}
// 验证构建结果
- if (buildParametersContext.Parameters.IsVerifyBuildingResult)
+ if (buildParametersContext.Parameters.VerifyBuildingResult)
{
VerifyingBuildingResult(context, unityManifest);
}
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCopyBuildinFiles.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCopyBuildinFiles.cs
index faa917a..bdfb867 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCopyBuildinFiles.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCopyBuildinFiles.cs
@@ -15,7 +15,7 @@ namespace YooAsset.Editor
{
// 注意:我们只有在强制重建的时候才会拷贝
var buildParameters = context.GetContextObject();
- if(buildParameters.Parameters.IsForceRebuild)
+ if(buildParameters.Parameters.ForceRebuild)
{
// 清空流目录
AssetBundleBuilderHelper.ClearStreamingAssetsFolder();
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs
index 491f6f3..d37a938 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs
@@ -56,7 +56,7 @@ namespace YooAsset.Editor
// 加载旧补丁清单
PatchManifest oldPatchManifest = null;
- if (buildParameters.Parameters.IsForceRebuild == false)
+ if (buildParameters.Parameters.ForceRebuild == false)
{
oldPatchManifest = AssetBundleBuilderHelper.LoadPatchManifestFile(buildParameters.PipelineOutputDirectory);
}
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReadme.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReadme.cs
index 996d5a7..0905e97 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReadme.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReadme.cs
@@ -36,11 +36,11 @@ namespace YooAsset.Editor
AppendData(content, $"构建时间:{DateTime.Now}");
AppendData(content, $"构建平台:{buildParameters.Parameters.BuildTarget}");
AppendData(content, $"构建版本:{buildParameters.Parameters.BuildVersion}");
- AppendData(content, $"冗余机制:{buildParameters.Parameters.ApplyRedundancy}");
+ AppendData(content, $"自动分包:{buildParameters.Parameters.EnableAutoCollect}");
AppendData(content, "");
AppendData(content, $"--着色器--");
- AppendData(content, $"IsCollectAllShaders:{AssetBundleCollectorSettingData.Setting.IsCollectAllShaders}");
+ AppendData(content, $"IsCollectAllShaders:{AssetBundleCollectorSettingData.Setting.AutoCollectShaders}");
AppendData(content, $"ShadersBundleName:{AssetBundleCollectorSettingData.Setting.ShadersBundleName}");
AppendData(content, "");
@@ -54,12 +54,12 @@ namespace YooAsset.Editor
AppendData(content, "");
AppendData(content, $"--构建参数--");
AppendData(content, $"CompressOption:{buildParameters.Parameters.CompressOption}");
- AppendData(content, $"IsForceRebuild:{buildParameters.Parameters.IsForceRebuild}");
+ AppendData(content, $"IsForceRebuild:{buildParameters.Parameters.ForceRebuild}");
AppendData(content, $"BuildinTags:{buildParameters.Parameters.BuildinTags}");
- AppendData(content, $"IsAppendHash:{buildParameters.Parameters.IsAppendHash}");
- AppendData(content, $"IsDisableWriteTypeTree:{buildParameters.Parameters.IsDisableWriteTypeTree}");
- AppendData(content, $"IsIgnoreTypeTreeChanges:{buildParameters.Parameters.IsIgnoreTypeTreeChanges}");
- AppendData(content, $"IsDisableLoadAssetByFileName : {buildParameters.Parameters.IsDisableLoadAssetByFileName}");
+ AppendData(content, $"IsAppendHash:{buildParameters.Parameters.AppendHash}");
+ AppendData(content, $"IsDisableWriteTypeTree:{buildParameters.Parameters.DisableWriteTypeTree}");
+ AppendData(content, $"IsIgnoreTypeTreeChanges:{buildParameters.Parameters.IgnoreTypeTreeChanges}");
+ AppendData(content, $"IsDisableLoadAssetByFileName : {buildParameters.Parameters.DisableLoadAssetByFileName}");
AppendData(content, "");
AppendData(content, $"--构建信息--");
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs
index c903564..fbd2db3 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs
@@ -22,22 +22,37 @@ namespace YooAsset.Editor
BuildReport buildReport = new BuildReport();
// 概述信息
- buildReport.Summary.UnityVersion = UnityEngine.Application.unityVersion;
- buildReport.Summary.BuildTime = DateTime.Now.ToString();
- buildReport.Summary.BuildSeconds = 0;
- buildReport.Summary.BuildTarget = buildParameters.Parameters.BuildTarget;
- buildReport.Summary.BuildVersion = buildParameters.Parameters.BuildVersion;
- buildReport.Summary.ApplyRedundancy = buildParameters.Parameters.ApplyRedundancy;
- buildReport.Summary.AppendFileExtension = buildParameters.Parameters.AppendFileExtension;
- buildReport.Summary.IsCollectAllShaders = AssetBundleCollectorSettingData.Setting.IsCollectAllShaders;
- buildReport.Summary.ShadersBundleName = AssetBundleCollectorSettingData.Setting.ShadersBundleName;
- buildReport.Summary.IsForceRebuild = buildParameters.Parameters.IsForceRebuild;
- buildReport.Summary.BuildinTags = buildParameters.Parameters.BuildinTags;
- buildReport.Summary.CompressOption = buildParameters.Parameters.CompressOption;
- buildReport.Summary.IsAppendHash = buildParameters.Parameters.IsAppendHash;
- buildReport.Summary.IsDisableWriteTypeTree = buildParameters.Parameters.IsDisableWriteTypeTree;
- buildReport.Summary.IsIgnoreTypeTreeChanges = buildParameters.Parameters.IsIgnoreTypeTreeChanges;
- buildReport.Summary.IsDisableLoadAssetByFileName = buildParameters.Parameters.IsDisableLoadAssetByFileName;
+ {
+ buildReport.Summary.UnityVersion = UnityEngine.Application.unityVersion;
+ buildReport.Summary.BuildTime = DateTime.Now.ToString();
+ buildReport.Summary.BuildSeconds = 0;
+ buildReport.Summary.BuildTarget = buildParameters.Parameters.BuildTarget;
+ buildReport.Summary.BuildVersion = buildParameters.Parameters.BuildVersion;
+ buildReport.Summary.EnableAutoCollect = buildParameters.Parameters.EnableAutoCollect;
+ buildReport.Summary.AppendFileExtension = buildParameters.Parameters.AppendFileExtension;
+ buildReport.Summary.AutoCollectShaders = AssetBundleCollectorSettingData.Setting.AutoCollectShaders;
+ buildReport.Summary.ShadersBundleName = AssetBundleCollectorSettingData.Setting.ShadersBundleName;
+
+ // 构建参数
+ buildReport.Summary.ForceRebuild = buildParameters.Parameters.ForceRebuild;
+ buildReport.Summary.BuildinTags = buildParameters.Parameters.BuildinTags;
+ buildReport.Summary.CompressOption = buildParameters.Parameters.CompressOption;
+ buildReport.Summary.AppendHash = buildParameters.Parameters.AppendHash;
+ buildReport.Summary.DisableWriteTypeTree = buildParameters.Parameters.DisableWriteTypeTree;
+ buildReport.Summary.IgnoreTypeTreeChanges = buildParameters.Parameters.IgnoreTypeTreeChanges;
+ buildReport.Summary.DisableLoadAssetByFileName = buildParameters.Parameters.DisableLoadAssetByFileName;
+
+ // 构建结果
+ buildReport.Summary.AssetFileTotalCount = buildMapContext.AssetFileCount;
+ buildReport.Summary.AllBundleTotalCount = GetAllBundleCount(patchManifest);
+ buildReport.Summary.AllBundleTotalSize = GetAllBundleSize(patchManifest);
+ buildReport.Summary.BuildinBundleTotalCount = GetBuildinBundleCount(patchManifest);
+ buildReport.Summary.BuildinBundleTotalSize = GetBuildinBundleSize(patchManifest);
+ buildReport.Summary.EncryptedBundleTotalCount = GetEncryptedBundleCount(patchManifest);
+ buildReport.Summary.EncryptedBundleTotalSize = GetEncryptedBundleSize(patchManifest);
+ buildReport.Summary.RawBundleTotalCount = GetRawBundleCount(patchManifest);
+ buildReport.Summary.RawBundleTotalSize = GetRawBundleSize(patchManifest);
+ }
// 资源对象列表
buildReport.AssetInfos = new List(patchManifest.AssetList.Count);
@@ -85,7 +100,7 @@ namespace YooAsset.Editor
private List GetDependBundles(PatchManifest patchManifest, PatchAsset patchAsset)
{
List dependBundles = new List(patchAsset.DependIDs.Length);
- foreach(int index in patchAsset.DependIDs)
+ foreach (int index in patchAsset.DependIDs)
{
string dependBundleName = patchManifest.BundleList[index].BundleName;
dependBundles.Add(dependBundleName);
@@ -99,12 +114,12 @@ namespace YooAsset.Editor
private List GetDependAssets(TaskGetBuildMap.BuildMapContext buildMapContext, string bundleName, string assetPath)
{
List result = new List();
- if(buildMapContext.TryGetBundleInfo(bundleName, out BuildBundleInfo bundleInfo))
+ if (buildMapContext.TryGetBundleInfo(bundleName, out BuildBundleInfo bundleInfo))
{
BuildAssetInfo findAssetInfo = null;
- foreach(var buildinAsset in bundleInfo.BuildinAssets)
+ foreach (var buildinAsset in bundleInfo.BuildinAssets)
{
- if(buildinAsset.AssetPath == assetPath)
+ if (buildinAsset.AssetPath == assetPath)
{
findAssetInfo = buildinAsset;
break;
@@ -114,7 +129,7 @@ namespace YooAsset.Editor
{
throw new Exception($"Not found asset {assetPath} in bunlde {bundleName}");
}
- foreach(var dependAssetInfo in findAssetInfo.AllDependAssetInfos)
+ foreach (var dependAssetInfo in findAssetInfo.AllDependAssetInfos)
{
result.Add(dependAssetInfo.AssetPath);
}
@@ -125,5 +140,79 @@ namespace YooAsset.Editor
}
return result;
}
+
+ private int GetAllBundleCount(PatchManifest patchManifest)
+ {
+ return patchManifest.BundleList.Count;
+ }
+ private long GetAllBundleSize(PatchManifest patchManifest)
+ {
+ long fileBytes = 0;
+ foreach (var patchBundle in patchManifest.BundleList)
+ {
+ fileBytes += patchBundle.SizeBytes;
+ }
+ return fileBytes;
+ }
+ private int GetBuildinBundleCount(PatchManifest patchManifest)
+ {
+ int fileCount = 0;
+ foreach (var patchBundle in patchManifest.BundleList)
+ {
+ if (patchBundle.IsBuildin)
+ fileCount++;
+ }
+ return fileCount;
+ }
+ private long GetBuildinBundleSize(PatchManifest patchManifest)
+ {
+ long fileBytes = 0;
+ foreach (var patchBundle in patchManifest.BundleList)
+ {
+ if (patchBundle.IsBuildin)
+ fileBytes += patchBundle.SizeBytes;
+ }
+ return fileBytes;
+ }
+ private int GetEncryptedBundleCount(PatchManifest patchManifest)
+ {
+ int fileCount = 0;
+ foreach (var patchBundle in patchManifest.BundleList)
+ {
+ if (patchBundle.IsEncrypted)
+ fileCount++;
+ }
+ return fileCount;
+ }
+ private long GetEncryptedBundleSize(PatchManifest patchManifest)
+ {
+ long fileBytes = 0;
+ foreach (var patchBundle in patchManifest.BundleList)
+ {
+ if (patchBundle.IsEncrypted)
+ fileBytes += patchBundle.SizeBytes;
+ }
+ return fileBytes;
+ }
+ private int GetRawBundleCount(PatchManifest patchManifest)
+ {
+ int fileCount = 0;
+ foreach (var patchBundle in patchManifest.BundleList)
+ {
+ if (patchBundle.IsRawFile)
+ fileCount++;
+ }
+ return fileCount;
+ }
+ private long GetRawBundleSize(PatchManifest patchManifest)
+ {
+ long fileBytes = 0;
+ foreach (var patchBundle in patchManifest.BundleList)
+ {
+ if (patchBundle.IsRawFile)
+ fileBytes += patchBundle.SizeBytes;
+ }
+ return fileBytes;
+ }
}
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskGetBuildMap.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskGetBuildMap.cs
index bce262c..9a5c1fd 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskGetBuildMap.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskGetBuildMap.cs
@@ -11,6 +11,12 @@ namespace YooAsset.Editor
{
public class BuildMapContext : IContextObject
{
+ ///
+ /// 参与构建的资源总数
+ /// 说明:包括主动收集的资源以及其依赖的所有资源
+ ///
+ public int AssetFileCount;
+
///
/// 资源包列表
///
@@ -179,7 +185,10 @@ namespace YooAsset.Editor
}
EditorTools.ClearProgressBar();
- // 3. 移除零依赖的资源
+ // 3. 记录参与构建的资源总数
+ buildMapContext.AssetFileCount = buildAssetDic.Values.Count;
+
+ // 4. 移除零依赖的资源
var redundancy = CreateAssetRedundancy();
List undependentAssets = new List();
foreach (KeyValuePair pair in buildAssetDic)
@@ -196,18 +205,15 @@ namespace YooAsset.Editor
}
// 冗余扩展
- if(redundancy != null)
+ if (redundancy != null && redundancy.Check(buildAssetInfo.AssetPath))
{
- if(redundancy.Check(buildAssetInfo.AssetPath))
- {
- undependentAssets.Add(buildAssetInfo);
- buildMapContext.RedundancyAssetList.Add(buildAssetInfo.AssetPath);
- continue;
- }
+ undependentAssets.Add(buildAssetInfo);
+ buildMapContext.RedundancyAssetList.Add(buildAssetInfo.AssetPath);
+ continue;
}
- // 冗余机制
- if (buildParameters.Parameters.ApplyRedundancy)
+ // 如果没有开启自动分包,没有被收集到的资源会造成冗余
+ if (buildParameters.Parameters.EnableAutoCollect == false)
{
if (AssetBundleCollectorSettingData.HasCollector(buildAssetInfo.AssetPath) == false)
{
@@ -221,7 +227,7 @@ namespace YooAsset.Editor
buildAssetDic.Remove(assetInfo.AssetPath);
}
- // 4. 设置资源包名
+ // 5. 设置资源包名
progressValue = 0;
foreach (KeyValuePair pair in buildAssetDic)
{
@@ -235,7 +241,7 @@ namespace YooAsset.Editor
}
EditorTools.ClearProgressBar();
- // 4. 构建资源包
+ // 6. 构建资源包
var allAssets = buildAssetDic.Values.ToList();
if (allAssets.Count == 0)
throw new Exception("构建的资源列表不能为空");
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskPrepare.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskPrepare.cs
index 8bba665..a2adefa 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskPrepare.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskPrepare.cs
@@ -29,7 +29,7 @@ namespace YooAsset.Editor
throw new Exception("配置的资源收集路径为空");
// 增量更新时候的必要检测
- if (buildParameters.Parameters.IsForceRebuild == false)
+ if (buildParameters.Parameters.ForceRebuild == false)
{
// 检测历史版本是否存在
if (AssetBundleBuilderHelper.HasAnyPackageVersion(buildParameters.Parameters.BuildTarget, buildParameters.Parameters.OutputRoot) == false)
@@ -52,7 +52,7 @@ namespace YooAsset.Editor
}
// 如果是强制重建
- if (buildParameters.Parameters.IsForceRebuild)
+ if (buildParameters.Parameters.ForceRebuild)
{
// 删除平台总目录
string platformDirectory = $"{buildParameters.Parameters.OutputRoot}/{buildParameters.Parameters.BuildTarget}";