mirror of https://github.com/tuyoogame/YooAsset
fix #387
parent
376088e63c
commit
763054884b
|
@ -25,6 +25,9 @@ namespace YooAsset.Editor
|
|||
var buildParameters = buildParametersContext.Parameters;
|
||||
string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
|
||||
|
||||
// 检测资源包哈希冲突
|
||||
CheckBundleHashConflict(buildMapContext);
|
||||
|
||||
// 创建新补丁清单
|
||||
PackageManifest manifest = new PackageManifest();
|
||||
manifest.FileVersion = YooAssetSettings.ManifestFileVersion;
|
||||
|
@ -88,6 +91,27 @@ namespace YooAsset.Editor
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检测资源包哈希冲突
|
||||
/// </summary>
|
||||
private void CheckBundleHashConflict(BuildMapContext buildMapContext)
|
||||
{
|
||||
// 说明:在特殊情况下,例如某些文件加密算法会导致加密后的文件哈希值冲突!
|
||||
HashSet<string> guids = new HashSet<string>();
|
||||
foreach (var bundleInfo in buildMapContext.Collection)
|
||||
{
|
||||
if (guids.Contains(bundleInfo.PackageFileHash))
|
||||
{
|
||||
string message = BuildLogger.GetErrorMessage(ErrorCode.BundleHashConflict, $"Bundle hash conflict : {bundleInfo.BundleName}");
|
||||
throw new Exception(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
guids.Add(bundleInfo.PackageFileHash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源包的依赖集合
|
||||
/// </summary>
|
||||
|
|
|
@ -39,5 +39,6 @@ namespace YooAsset.Editor
|
|||
// TaskCreateManifest
|
||||
NotFoundUnityBundleInBuildResult = 600,
|
||||
FoundStrayBundle = 601,
|
||||
BundleHashConflict = 602,
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue