diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildBundleInfo.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildBundleInfo.cs
index 9308d2c..b222759 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildBundleInfo.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildBundleInfo.cs
@@ -40,21 +40,6 @@ namespace YooAsset.Editor
///
public string ContentHash { set; get; } = "00000000000000000000000000000000"; //32位
- ///
- /// 文件哈希值
- ///
- public string FileHash { set; get; } = "00000000000000000000000000000000"; //32位
-
- ///
- /// 文件CRC32
- ///
- public string FileCRC { set; get; } = "00000000"; //8位
-
- ///
- /// 文件大小
- ///
- public long FileSize { set; get; } = 0;
-
public BuildBundleInfo(string bundleName)
{
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskBuilding.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskBuilding.cs
index 4f04d51..375384b 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskBuilding.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskBuilding.cs
@@ -68,13 +68,10 @@ namespace YooAsset.Editor
{
foreach (var bundleInfo in buildMapContext.BundleInfos)
{
- string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
- bundleInfo.FileHash = HashUtility.FileMD5(filePath);
- bundleInfo.FileCRC = HashUtility.FileCRC32(filePath);
- bundleInfo.FileSize = FileUtility.GetFileSize(filePath);
if (bundleInfo.IsRawFile)
{
- bundleInfo.ContentHash = bundleInfo.FileHash;
+ string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
+ bundleInfo.ContentHash = HashUtility.FileMD5(filePath);
}
else
{
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskBuilding_SBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskBuilding_SBP.cs
index 7cda86e..d2fa771 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskBuilding_SBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskBuilding_SBP.cs
@@ -79,13 +79,10 @@ namespace YooAsset.Editor
{
foreach (var bundleInfo in buildMapContext.BundleInfos)
{
- string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
- bundleInfo.FileHash = HashUtility.FileMD5(filePath);
- bundleInfo.FileCRC = HashUtility.FileCRC32(filePath);
- bundleInfo.FileSize = FileUtility.GetFileSize(filePath);
if (bundleInfo.IsRawFile)
{
- bundleInfo.ContentHash = bundleInfo.FileHash;
+ string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
+ bundleInfo.ContentHash = HashUtility.FileMD5(filePath);
}
else
{
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs
index b91f3aa..1ea6f0f 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs
@@ -74,9 +74,9 @@ namespace YooAsset.Editor
foreach (var bundleInfo in buildMapContext.BundleInfos)
{
var bundleName = bundleInfo.BundleName;
- string fileHash = bundleInfo.FileHash;
- string fileCRC = bundleInfo.FileCRC;
- long fileSize = bundleInfo.FileSize;
+ string fileHash = GetBundleFileHash(bundleInfo, buildParameters);
+ string fileCRC = GetBundleFileCRC(bundleInfo, buildParameters);
+ long fileSize = GetBundleFileSize(bundleInfo, buildParameters);
string[] tags = buildMapContext.GetBundleTags(bundleName);
bool isEncrypted = encryptionContext.IsEncryptFile(bundleName);
bool isBuildin = IsBuildinBundle(tags, buildinTags);
@@ -102,6 +102,33 @@ namespace YooAsset.Editor
}
return false;
}
+ private string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
+ {
+ var buildMode = buildParametersContext.Parameters.BuildMode;
+ if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
+ return "00000000000000000000000000000000"; //32位
+
+ string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
+ return HashUtility.FileMD5(filePath);
+ }
+ private string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
+ {
+ var buildMode = buildParametersContext.Parameters.BuildMode;
+ if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
+ return "00000000"; //8位
+
+ string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
+ return HashUtility.FileCRC32(filePath);
+ }
+ private long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
+ {
+ var buildMode = buildParametersContext.Parameters.BuildMode;
+ if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
+ return 0;
+
+ string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
+ return FileUtility.GetFileSize(filePath);
+ }
///
/// 获取资源列表