We are using addressables for almost a year already and I thought I could handle them but apparently I cannot. So far we’ve been using addressables for loading scenes but now we want to extend the system to loading assets. So here is my current test setup:
All I want is to instantiate the ‘LoungeChair2’. Loading it using Addressables.LoadAssetAsync("keyOfTheAsset");
resulted in an Invalid Key Exception. Because I thought it my be due to a invalid string I tried the following code:
foreach(IResourceLocator r in Addressables.ResourceLocators)
{
Debug.Log("Locator ID: " + r.LocatorId.ToString());
foreach(object k in r.Keys)
{
Debug.Log("Locator Key: '" + k.ToString() + "'");
if(k.ToString().Equals(key))
{
AsyncOperationHandle<GameObject> handle = Addressables.LoadAssetAsync<GameObject>(k);
while (!handle.IsDone) { yield return null; }
yield return handle.Result;
}
}
}
I cycle though all keys that are currently loaded and load on of them. So the key cannot be invalid?! But somehow it still is? What am I missing out? Catalog, dependencys are loaded before and addressables are instantiated.The console looks like this: