From 0f9e9326164e670bd83fc9bb2e730c1c217a2710 Mon Sep 17 00:00:00 2001 From: hanazonoyurine <50166281+hanazonoyurine@users.noreply.github.com> Date: Thu, 27 Apr 2023 16:30:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E5=AF=BB=E5=9D=80=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E5=86=B2=E7=AA=81=E6=97=B6=EF=BC=8C=E6=89=93=E5=8D=B0=E5=86=B2?= =?UTF-8?q?=E7=AA=81=E5=9C=B0=E5=9D=80=E7=9A=84=E8=B5=84=E6=BA=90=E5=9C=B0?= =?UTF-8?q?=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Editor/AssetBundleCollector/AssetBundleCollector.cs | 9 +++++---- .../AssetBundleCollector/AssetBundleCollectorGroup.cs | 9 +++++---- .../AssetBundleCollector/AssetBundleCollectorPackage.cs | 9 +++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs index b344a42..5fe9474 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs @@ -197,16 +197,17 @@ namespace YooAsset.Editor // 检测可寻址地址是否重复 if (command.EnableAddressable) { - HashSet adressTemper = new HashSet(); + var addressTemper = new Dictionary(); foreach (var collectInfoPair in result) { if (collectInfoPair.Value.CollectorType == ECollectorType.MainAssetCollector) { string address = collectInfoPair.Value.Address; - if (adressTemper.Contains(address) == false) - adressTemper.Add(address); + string assetPath = collectInfoPair.Value.AssetPath; + if (addressTemper.TryGetValue(address, out var existed) == false) + addressTemper.Add(address, assetPath); else - throw new Exception($"The address is existed : {address} in collector : {CollectPath}"); + throw new Exception($"The address is existed : {address} in collector : {CollectPath}.\nAssetPath:\n {existed}\n {assetPath}"); } } } diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorGroup.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorGroup.cs index 0575619..8ae3037 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorGroup.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorGroup.cs @@ -96,16 +96,17 @@ namespace YooAsset.Editor // 检测可寻址地址是否重复 if (command.EnableAddressable) { - HashSet adressTemper = new HashSet(); + var addressTemper = new Dictionary(); foreach (var collectInfoPair in result) { if (collectInfoPair.Value.CollectorType == ECollectorType.MainAssetCollector) { string address = collectInfoPair.Value.Address; - if (adressTemper.Contains(address) == false) - adressTemper.Add(address); + string assetPath = collectInfoPair.Value.AssetPath; + if (addressTemper.TryGetValue(address, out var existed) == false) + addressTemper.Add(address, assetPath); else - throw new Exception($"The address is existed : {address} in group : {GroupName}"); + throw new Exception($"The address is existed : {address} in group : {GroupName}.\nAssetPath:\n{existed}\n{assetPath}"); } } } diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorPackage.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorPackage.cs index df6a8f2..a912c1c 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorPackage.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorPackage.cs @@ -76,16 +76,17 @@ namespace YooAsset.Editor // 检测可寻址地址是否重复 if (command.EnableAddressable) { - HashSet adressTemper = new HashSet(); + var addressTemper = new Dictionary(); foreach (var collectInfoPair in result) { if (collectInfoPair.Value.CollectorType == ECollectorType.MainAssetCollector) { string address = collectInfoPair.Value.Address; - if (adressTemper.Contains(address) == false) - adressTemper.Add(address); + string assetPath = collectInfoPair.Value.AssetPath; + if (addressTemper.TryGetValue(address, out var existed) == false) + addressTemper.Add(address, assetPath); else - throw new Exception($"The address is existed : {address}"); + throw new Exception($"The address is existed : {address}.\nAssetPath:\n {existed}\n {assetPath}"); } } }