Merge pull request #102 from hanazonoyurine/main

可寻址地址冲突时,打印冲突地址的资源地址
main
何冠峰 2023-05-04 10:46:44 +08:00 committed by GitHub
commit 17ab618bed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 12 deletions

View File

@ -197,16 +197,17 @@ namespace YooAsset.Editor
// 检测可寻址地址是否重复 // 检测可寻址地址是否重复
if (command.EnableAddressable) if (command.EnableAddressable)
{ {
HashSet<string> adressTemper = new HashSet<string>(); var addressTemper = new Dictionary<string, string>();
foreach (var collectInfoPair in result) foreach (var collectInfoPair in result)
{ {
if (collectInfoPair.Value.CollectorType == ECollectorType.MainAssetCollector) if (collectInfoPair.Value.CollectorType == ECollectorType.MainAssetCollector)
{ {
string address = collectInfoPair.Value.Address; string address = collectInfoPair.Value.Address;
if (adressTemper.Contains(address) == false) string assetPath = collectInfoPair.Value.AssetPath;
adressTemper.Add(address); if (addressTemper.TryGetValue(address, out var existed) == false)
addressTemper.Add(address, assetPath);
else 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}");
} }
} }
} }

View File

@ -96,16 +96,17 @@ namespace YooAsset.Editor
// 检测可寻址地址是否重复 // 检测可寻址地址是否重复
if (command.EnableAddressable) if (command.EnableAddressable)
{ {
HashSet<string> adressTemper = new HashSet<string>(); var addressTemper = new Dictionary<string, string>();
foreach (var collectInfoPair in result) foreach (var collectInfoPair in result)
{ {
if (collectInfoPair.Value.CollectorType == ECollectorType.MainAssetCollector) if (collectInfoPair.Value.CollectorType == ECollectorType.MainAssetCollector)
{ {
string address = collectInfoPair.Value.Address; string address = collectInfoPair.Value.Address;
if (adressTemper.Contains(address) == false) string assetPath = collectInfoPair.Value.AssetPath;
adressTemper.Add(address); if (addressTemper.TryGetValue(address, out var existed) == false)
addressTemper.Add(address, assetPath);
else 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}");
} }
} }
} }

View File

@ -76,16 +76,17 @@ namespace YooAsset.Editor
// 检测可寻址地址是否重复 // 检测可寻址地址是否重复
if (command.EnableAddressable) if (command.EnableAddressable)
{ {
HashSet<string> adressTemper = new HashSet<string>(); var addressTemper = new Dictionary<string, string>();
foreach (var collectInfoPair in result) foreach (var collectInfoPair in result)
{ {
if (collectInfoPair.Value.CollectorType == ECollectorType.MainAssetCollector) if (collectInfoPair.Value.CollectorType == ECollectorType.MainAssetCollector)
{ {
string address = collectInfoPair.Value.Address; string address = collectInfoPair.Value.Address;
if (adressTemper.Contains(address) == false) string assetPath = collectInfoPair.Value.AssetPath;
adressTemper.Add(address); if (addressTemper.TryGetValue(address, out var existed) == false)
addressTemper.Add(address, assetPath);
else else
throw new Exception($"The address is existed : {address}"); throw new Exception($"The address is existed : {address}.\nAssetPath:\n {existed}\n {assetPath}");
} }
} }
} }