Compare commits

..

No commits in common. "9b4abf86b6f0eeadf4085b4da7d9bb835544090e" and "e31799e78b996515bebf43a58380ac694877cd84" have entirely different histories.

3 changed files with 13 additions and 16 deletions

View File

@ -204,10 +204,6 @@ namespace YooAsset.Editor
{ {
string address = collectInfoPair.Value.Address; string address = collectInfoPair.Value.Address;
string assetPath = collectInfoPair.Value.AssetPath; string assetPath = collectInfoPair.Value.AssetPath;
if (address.StartsWith("Assets/") || address.StartsWith("assets/"))
throw new Exception($"The address can not set asset path in collector : {CollectPath} \nAssetPath: {assetPath}");
if (addressTemper.TryGetValue(address, out var existed) == false) if (addressTemper.TryGetValue(address, out var existed) == false)
addressTemper.Add(address, assetPath); addressTemper.Add(address, assetPath);
else else

View File

@ -16,7 +16,7 @@ namespace YooAsset.Editor
{ {
string IAddressRule.GetAssetAddress(AddressRuleData data) string IAddressRule.GetAssetAddress(AddressRuleData data)
{ {
throw new System.Exception("可寻址模式下已经默认支持通过资源路径加载!"); return data.AssetPath;
} }
} }

View File

@ -97,7 +97,7 @@ namespace YooAsset
Manifest.AssetDic = new Dictionary<string, PackageAsset>(_packageAssetCount); Manifest.AssetDic = new Dictionary<string, PackageAsset>(_packageAssetCount);
if (Manifest.EnableAddressable) if (Manifest.EnableAddressable)
Manifest.AssetPathMapping1 = new Dictionary<string, string>(_packageAssetCount * 3); Manifest.AssetPathMapping1 = new Dictionary<string, string>(_packageAssetCount);
else else
Manifest.AssetPathMapping1 = new Dictionary<string, string>(_packageAssetCount * 2); Manifest.AssetPathMapping1 = new Dictionary<string, string>(_packageAssetCount * 2);
@ -130,6 +130,15 @@ namespace YooAsset
Manifest.AssetDic.Add(assetPath, packageAsset); Manifest.AssetDic.Add(assetPath, packageAsset);
// 填充AssetPathMapping1 // 填充AssetPathMapping1
if (Manifest.EnableAddressable)
{
string location = packageAsset.Address;
if (Manifest.AssetPathMapping1.ContainsKey(location))
throw new System.Exception($"Address have existed : {location}");
else
Manifest.AssetPathMapping1.Add(location, packageAsset.AssetPath);
}
else
{ {
string location = packageAsset.AssetPath; string location = packageAsset.AssetPath;
if (Manifest.LocationToLower) if (Manifest.LocationToLower)
@ -137,7 +146,7 @@ namespace YooAsset
// 添加原生路径的映射 // 添加原生路径的映射
if (Manifest.AssetPathMapping1.ContainsKey(location)) if (Manifest.AssetPathMapping1.ContainsKey(location))
throw new System.Exception($"Location have existed : {location}"); throw new System.Exception($"AssetPath have existed : {location}");
else else
Manifest.AssetPathMapping1.Add(location, packageAsset.AssetPath); Manifest.AssetPathMapping1.Add(location, packageAsset.AssetPath);
@ -146,19 +155,11 @@ namespace YooAsset
{ {
string locationWithoutExtension = PathUtility.RemoveExtension(location); string locationWithoutExtension = PathUtility.RemoveExtension(location);
if (Manifest.AssetPathMapping1.ContainsKey(locationWithoutExtension)) if (Manifest.AssetPathMapping1.ContainsKey(locationWithoutExtension))
YooLogger.Warning($"Location have existed : {locationWithoutExtension}"); YooLogger.Warning($"AssetPath have existed : {locationWithoutExtension}");
else else
Manifest.AssetPathMapping1.Add(locationWithoutExtension, packageAsset.AssetPath); Manifest.AssetPathMapping1.Add(locationWithoutExtension, packageAsset.AssetPath);
} }
} }
if (Manifest.EnableAddressable)
{
string location = packageAsset.Address;
if (Manifest.AssetPathMapping1.ContainsKey(location))
throw new System.Exception($"Location have existed : {location}");
else
Manifest.AssetPathMapping1.Add(location, packageAsset.AssetPath);
}
// 填充AssetPathMapping2 // 填充AssetPathMapping2
if (Manifest.IncludeAssetGUID) if (Manifest.IncludeAssetGUID)