Search Issue Tracker
Won't Fix
Votes
0
Found in [Package]
1.3.3.
Issue ID
1200639
Regression
Yes
[Addressables] Unhandled exceptions appear when trying to catch wrapped Addressables.GetDownloadSizeAsync function
To reproduce:
1. Open the QA attached project "1200639.zip"
2. Press play
3. Check the console for errors
Actual result: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException'
Expected result: there should be no exceptions
Reproduced on: 2018.4.14f1; 2020.1.0a15
Can not reproduce on 2017.4, no package manager
Introduced in: Addressable package 1.3.3 and newer
Error:
Exception encountered in operation UnityEngine.AddressableAssets.Initialization.InitializationOperation, result='', status='Failed' - Chain<Int64>: ChainOperation of Type: System.Int64 failed because dependent operation failed
Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=someName
UnityEngine.ResourceManagement.ChainOperationTypelessDepedency`1:OnWrappedCompleted(AsyncOperationHandle`1)
DelegateList`1:Invoke(AsyncOperationHandle`1) (at Library/PackageCache/com.unity.addressables@1.4.0/Runtime/ResourceManager/Util/DelegateList.cs:69)
UnityEngine.ResourceManagement.ResourceManager:Update(Single)
Code:
void Start()
{
try {
Addressables.GetDownloadSizeAsync("someName").Completed +=DownloadSizeResult;
}
catch (Exception ex)
{
Debug.Log("GetDownloadSizeAsync error: " + ex.Message);
}
}
private void DownloadSizeResult(AsyncOperationHandle<long> obj)
{
if (obj.Status == AsyncOperationStatus.Succeeded)
{
Debug.Log("DownloadSizeResult success");
}
}
Comments (2)
-
zauberzaubar
Feb 03, 2021 15:19
Also it is possible to just disable the exceptions (which IMHO should be the default):
https://forum.unity.com/threads/how-do-i-catch-an-exception-caused-by-addressables-loadcontentcatalogasync.873058/ -
PavelKlym
Aug 25, 2020 16:34
Why I can't just get subscribe to Complete event and get the callback with status failed (and exception inside) instead of subscribing to ResourceManager.ExceptionHandler? How is it possible to find ResourceManager.ExceptionHandler to handle error properly without this reported issue?! Thanks to the author!
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Redoing creation of Sub Scenes and Cube GameObjects in Hierarchy throws “Assertion failed on expression: 'targetScene != nullptr’” error in Console window
- Selecting “New Sub Scene” after assigning “New Scene” in Sub Scene Script Component throws “Destroying GameObjects immediately is not permitted” in the Console window
- Shader Graph "Zoom Step Size" can be set to 0 even though the zoom still works
- Enabling/Disabling the Deprecated Nodes doesn't apply to the opened Shader Graph unless any Variable is added to the Blackboard
- Group Selection title text size is smaller in renaming than the actual font size
Resolution Note:
Typically throwing invalid keys at the download will result in these errors, however, these are just errors, which is why the catch is not grabbing them.
These errors can be handled by the user in ResourceManager.ExceptionHandler, so if you wanted to handle the exception, give a better error, or warning, or ignore them all together you could create your own callback to handle it here.
We will update documentation in the future to outline this functionality, as we do understand that it's very confusing where these errors are coming from and how to deal with them, especially in cases where you may want to retry a download or try a different server if a download fails.