Unity 2023.2.20f1c1
Addressables 1.21.20
Addressables for Android 1.0.4
I started using: AndroidAssetPacks.DownloadAssetPackAsync(new string[] { curPackName }, DownloadStatus);
to download the OnDemand asset package, and everything was normal. Until I tested the download exception, such as disconnecting the network, I would receive an Error:NetworkError
The AndroidAssetPackInfo of the asset package is Failed.
Then the problem appeared. No matter what, I will get this error every time in the future, even if the network is normal. Get the package status through AndroidAssetPacks.GetAssetPackStateAsync(new string[] { curPackName });
, it is always Failed.
When I try to call the loading function again, an same NetworkError
is immediately returned, and the loading ends,I can’t re-download this asset package.
Please help me, this problem has been bothering me for a few days.
Post your code in verbatim, not just individual lines.
I would also try rebooting the device and computer just in case.
Normally the code works, but if the network is disconnected during downloading, it will not restart the download of the asset pack. I have tried restarting the app, restarting the phone, and reconnecting to the network, but nothing works. As soon as I start downloading, I get a network error. The only thing I can do at this time is to uninstall the game and install it again.
Since the download is an async operation, is it enclosed in try/catch? You may be getting an exception and this breaks the app henceforth. Check the player log.
“Restarting” the app on mobile is not just closing and tapping the icon, is it? Because this won’t actually restart the app, it’s closer to Alt+Tab on desktop. You’d have to force-close the app through the “task manager” equivalent on the device and swipe the app window “away” to end the process.
If you don’t try/catch async service calls, that’s the kind of situation you run into. An exception is a valid response that the app must handle and be prepared to respond accordingly, ie display “download failed” message or similar and return to a safe state.
Can you provide logcat for the situation when you can’t download asset pack and you get NetworkError immediately?
Also have you tried to remove problem asset pack before trying to re-download it (even though it wasn’t fully downloaded)?