Hey Unity,
For some sad reasons, I separated my project into several projects.
One project contains only static maps and it generates addressables. And the main project needs to load the static maps so that it can add dynamic elements on top of it, however, I found out that it cannot be loaded into the Editor. It makes me even sadder.
I can explain more about the sad reasons if you want to know but can you please support the edit time loading?
Addressables does not support synchronous loading. Use AssetDatabase.LoadAssetAtPath under the editor.
You can find the path of the resource by “address”;
public static string GetAssetPath(string address)
{
var aaSettings = AddressableAssetSettingsDefaultObject.Settings;
if (aaSettings == null)
throw new ArgumentException(nameof(aaSettings));
var entries = from addressableAssetGroup in aaSettings.groups
from entrie in addressableAssetGroup.entries
select entrie;
foreach (var entry in entries)
{
var allEntries = new List<AddressableAssetEntry>();
entry.GatherAllAssets(allEntries, true, true, false);
for (int i = 0; i < allEntries.Count; i++)
{
var assetEntry = allEntries[i];
if (assetEntry.address == address)
{
return assetEntry.AssetPath;
}
}
}
throw new ArgumentException("error key:" + address);
}