InvalidKeyException or 'Unknown error' when attempting to load mesh assets

I’m trying to use the Addressables system to load mesh assets at runtime. My Unity project is running on 2019.2.17f1, on Windows 10, with Addressables System v1.5. I’m using ‘Use Asset Database’ setting. I have generated a collection of mesh assets that are addressed thusly:

I have the addresses stored in a SQLite database and am retrieving lists of asset addresses via queries. Once the addresses have been received, the async load operation is called thusly (I know one can use LoadAssetsAsync for lists of assets but I am trying to get the singleton case working first):

            int nAssets = nearbyAssets.Count;

            _mesh = new Mesh();
            for(int i = 0; i < nAssets; i++)
            {
                AddressQueryResult queryResult = nearbyAssets[i];
                AsyncOperationHandle loadHandle = Addressables.LoadAssetAsync<GameObject>(queryResult.Address);
                loadHandle.Completed += OnKeyLoaded;
            }

The callback has zero functionality at the moment as I’m still debugging the async load operation:

private void OnKeyLoaded(AsyncOperationHandle handle)
        {
            Debug.Log("check handle contents");

            CombineInstance[] combines = new CombineInstance[1];
            //combines[0].mesh = loadedMesh;
            _mesh.CombineMeshes(combines);
        }

So far I have never made it to the callback without exceptions being thrown for every async load operation called.
If I set the load operation to be “Addressables.LoadAssetAsync(queryResults.Address)” then I get an InvalidKeyException, even though I know that the key string exactly matches the intended address:

If I set the load operation to be “Addressables.LoadAssetAsync(queryResults.Address)”
then I get a weird message saying “Unknown error in AsyncOperation”:

The second result seems closer to correct, since the Addressables module is apparently finding the correct asset with the given key and then running into an issue with loading it, but I am totally lost as to how to debug an ‘Unknown error’. The event viewer gives no hints as to the cause either.
Has anyone encountered this before? Is the Addressables system simply unable to load Mesh assets at this time?

UPDATE:
I have since created a base case in which the Addressable system fails to load even the most basic prefab object.

First, I created a default cube GameObject using the Create menu. I then turned this cube into a prefab called “DumbCube”. It has been set to addressable and given the address “mostbasic”:

I then created the most basic Addressable loader possible with this code:

public class SimpleAddressableLoader : MonoBehaviour
{
    public GameObject asset;

    void Start()
    {
        Addressables.LoadAssetAsync<GameObject>("mostbasic").Completed += SimpleAddressableLoader_Completed;
    }

    private void SimpleAddressableLoader_Completed(AsyncOperationHandle<GameObject> obj)
    {
        asset = Instantiate(obj.Result);
    }
}

Again, like before, I get an “Unkown error in AsyncOperation” exception before the callback is reached, meaning once again that the asset is being found and then something wacky is happening in the loading process.
With so few moving parts in this base case, I am led to believe that something in my project settings is to blame.

EDIT: I tried this same base case in a blank project with only the Addressables package imported and the asset loads just fine. So there is some sort of issue in my project that is causing the Addressables module to fail loading any assets.

Hello all, another dev on the team working with @dinomut here.

Like he said his most basic example works fine in an empty project. (unity 2019.2.17 addressables 1.5.0)

but when we try in our larger existing project loading anything from addessables in any mode or way just returns 2 exceptions:

UnityEngine.ResourceManagement.Util.DelayedActionManager:LateUpdate() (at Library/PackageCache/com.unity.addressables@1.5.0/Runtime/ResourceManager/Util/DelayedActionManager.cs:169)```

and 

```Exception encountered in operation UnityEngine.AddressableAssets.Initialization.InitializationOperation, result='', status='Succeeded' - Chain<GameObject>: ChainOperation of Type: UnityEngine.GameObject failed because dependent operation failed
Unknown error in AsyncOperation
UnityEngine.ResourceManagement.ChainOperationTypelessDepedency`1:OnWrappedCompleted(AsyncOperationHandle`1)
DelegateList`1:Invoke(AsyncOperationHandle`1) (at Library/PackageCache/com.unity.addressables@1.5.0/Runtime/ResourceManager/Util/DelegateList.cs:69)
UnityEngine.ResourceManagement.ResourceManager:Update(Single)
MonoBehaviourCallbackHooks:Update() (at Library/PackageCache/com.unity.addressables@1.5.0/Runtime/ResourceManager/Util/MonoBehaviourCallbackHooks.cs:19)```

I've been tracing and step through debugging all morning trying to figure out what might be causing the issue and it seems the exceptions are thrown when **ProvideHandle.Complete** is called from any of the ResourceProviders.

Any suggestions or advice on how to proceed or thoughts on what might be causing the issue would be much appreciated.

We figured it out. It was 100% because we had square brackets in the asset path as noted here:

It would be nice if a more intuitive message or warning could be shown or if the use of square brackets was mentioned somewhere in the addressable documentation.

1 Like