When I pass a label to load assets, and that label is not found, a couple of exceptions are thrown. Since these exceptions are thrown inside the addressables code, I can’t catch them.
My suggestion is to simply abort the process, and call the completed function with a “Not Found” status. This would allow us to handle this better in several ways:
We could look for new content, and download it.
We could simply ignore it if it were optional DLC for example.
The exceptions thrown when the label does not exist are as follows:
Exception encountered in operation UnityEngine.ResourceManagement.ResourceManager+CompletedOperation1[System.Collections.Generic.IList
1[UnityEngine.Object]], result=‘’, status=‘Failed’: Exception of type ‘UnityEngine.AddressableAssets.InvalidKeyException’ was thrown., Key=System.String[ ]
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1:<.ctor>b__27_0(AsyncOperationHandle) DelegateList
1:Invoke(AsyncOperationHandle) (at Library/PackageCache/com.unity.addressables@1.5.1/Runtime/ResourceManager/Util/DelegateList.cs:69)
UnityEngine.AddressableAssets.Initialization.<>c__DisplayClass13_0:b__0(AsyncOperationHandle1) DelegateList
1:Invoke(AsyncOperationHandle1) (at Library/PackageCache/com.unity.addressables@1.5.1/Runtime/ResourceManager/Util/DelegateList.cs:69) UnityEngine.ResourceManagement.ChainOperation
2:OnWrappedCompleted(AsyncOperationHandle1) DelegateList
1:Invoke(AsyncOperationHandle`1) (at Library/PackageCache/com.unity.addressables@1.5.1/Runtime/ResourceManager/Util/DelegateList.cs:69)
UnityEngine.ResourceManagement.ResourceManager:Update(Single)
MonoBehaviourCallbackHooks:Update() (at Library/PackageCache/com.unity.addressables@1.5.1/Runtime/ResourceManager/Util/MonoBehaviourCallbackHooks.cs:19)
And
Exception encountered in operation UnityEngine.AddressableAssets.Initialization.InitializationOperation, result=‘’, status=‘Succeeded’ - Chain<IList1>: ChainOperation of Type: System.Collections.Generic.IList
1[UnityEngine.Object] failed because dependent operation failed
Exception of type ‘UnityEngine.AddressableAssets.InvalidKeyException’ was thrown., Key=System.String[ ]
UnityEngine.ResourceManagement.ChainOperationTypelessDepedency1:OnWrappedCompleted(AsyncOperationHandle
1)
DelegateList1:Invoke(AsyncOperationHandle
1) (at Library/PackageCache/com.unity.addressables@1.5.1/Runtime/ResourceManager/Util/DelegateList.cs:69)
UnityEngine.ResourceManagement.ResourceManager:Update(Single)
MonoBehaviourCallbackHooks:Update() (at Library/PackageCache/com.unity.addressables@1.5.1/Runtime/ResourceManager/Util/MonoBehaviourCallbackHooks.cs:19)