可寻址模式下支持全路径加载资源

pull/36/head
Y-way 2022-08-16 10:52:32 +08:00
parent fbbf762e70
commit c099517a4d
1 changed files with 34 additions and 32 deletions

View File

@ -84,25 +84,17 @@ namespace YooAsset
{
if (locationToLower)
YooLogger.Error("Addressable not support location to lower !");
foreach (var patchAsset in AssetList)
{
string location = patchAsset.Address;
if (AssetPathMapping.ContainsKey(location))
throw new Exception($"Address have existed : {location}");
else
AssetPathMapping.Add(location, patchAsset.AssetPath);
}
}
else
{
_locationToLower = locationToLower;
}
foreach(var patchAsset in AssetList)
{
string location = patchAsset.AssetPath;
if(locationToLower)
location = location.ToLower();
// 添加原生路径的映射
if(AssetPathMapping.ContainsKey(location))
throw new Exception($"AssetPath have existed : {location}");
@ -118,8 +110,18 @@ namespace YooAsset
else
AssetPathMapping.Add(locationWithoutExtension, patchAsset.AssetPath);
}
// 可寻址路径映射
if(EnableAddressable)
{
// 可寻址路径
location = patchAsset.Address;
if(AssetPathMapping.ContainsKey(location))
throw new Exception($"Address have existed : {location}");
else
AssetPathMapping.Add(location, patchAsset.AssetPath);
}
}
}
/// <summary>