Call Addressables.LoadAssetAsync and WaitForCompletion cause an error.

OS : windows
Unity Version: 2021.3.13f1
addressable: 1.21.1

This is the code that calls Addressables.LoadAssetAsync and WaitForCompletion

and in WaitForCompletion, i got this error from UnityWebRequest, and following this post , i tried to find the exact code to dispose of the web request,

I found that in the addressable source code AssetBundleProvider.cs, there is a Dispose() in WebRequestOperationCompleted been called to that web request before IsAssetBundleDownloaded

after that Dispose(), IsAssetBundleDownloaded continued to check the same UnityWebRequest and got the _unity_self null error.

Any help will be thankful. Can i bypass this error by try-catch without any side-effect?

same issue here with unity2013.3.13 + addressable1.21.1:

ArgumentNullException: Value cannot be null.
Parameter name: _unity_self
UnityEngine.ResourceManagement.Util.UnityWebRequestUtilities.IsAssetBundleDownloaded

bump

This issue occurs when loading the first asset from an addressable bundle after running DownloadDependenciesAsync() and releasing its handle. This started happening after the 1.21.15 update.

Unity 2021.3.29f1
Addressables: 1.21.19

I have caught the exception in the following way, and it is working as expected.

original:

        public static bool IsAssetBundleDownloaded(UnityWebRequestAsyncOperation op)
        {
#if ENABLE_ASYNC_ASSETBUNDLE_UWR
            var handler = (DownloadHandlerAssetBundle)op.webRequest.downloadHandler;
            if (handler != null && handler.autoLoadAssetBundle)
                return handler.isDownloadComplete;
#endif
            return op.isDone;
        }

modified:

        public static bool IsAssetBundleDownloaded(UnityWebRequestAsyncOperation op)
        {
#if ENABLE_ASYNC_ASSETBUNDLE_UWR
            try
            {
                var handler = (DownloadHandlerAssetBundle)op.webRequest.downloadHandler;
                if (handler != null && handler.autoLoadAssetBundle)
                    return handler.isDownloadComplete;
            }
            catch (Exception e)
            {
                return true;
            }
#endif

            return op == null || op.isDone;
        }
1 Like

Bump.