I’m facing 2 problems with Addressables when used without an internet connection.
1 - I have a mobile game with multiple characters to chose from, I have all of the characters as addressables, 3 of those characters are in the local group and the rest are in the remote group.
Now this problem only happens when the game was installed on a device and was taken offline before starting the game for the first time.
Loading assets with label fails saying that it fails to fetch the remote group note that I have 3 characters with the same label in the local group but it’d still want to download the remote bundle and throws an exception.
My understanding would be that the addressables system should ignore any bundle that it doesn’t have access to and retrieve everything that it could
2 - Same game, I’ve noticed that if the LoadAssets ever failed, it wouldn’t work again even if you got internet connection back, i.e:
public void LoadCharacters(){
Debug.Log("Loading Characters");
Addressables.LoadAssets<Character>(CHARACTER_LABEL, null).Completed += op =>
{
Debug.Log("Assets loaded");
if (op.Status == AsyncOperationStatus.Failed)
{
Debug.Log("Assets loading failed");
}
else if (op.Status == AsyncOperationStatus.Succeeded)
{
Debug.Log("Assets loading success");
}
};
}
I have this stripped down method called LoadCharacter and I call it on a fresh install of the game while the device is offline, the logs shows this:
Assets loaded
Assets loading failed```
which is what's expected, now in the same session, I go online and call the method again, the logs would show this:
```Loading Characters```
and that's all I'm getting .. it wouldn't call the completed callback
Am I missing anything ?
HI, thanks for reporting this. It does not seem like you’re missing anything, as both of the scenarios you described should just work. So I’ve logged both of these in our bug tracking system. They seem straightforward for us to reproduce.
after that, whenever we try to repeat the operation of Addressables.DownloadDependenciesAsync(sceneRef) using the same sceneRef we get “Attempting to use an invalid operation handle” exception.
Another not cool thing is that the returned handle is still returning true for IsValid() method.
In effect, when Addressables.DownloadDependenciesAsync(sceneRef) fails due to network issues, the asset becomes unloadable untill the app is fully restarted.
In general, the problem of a failed operation getting stuck forever was fixed in version 1.1.9 last year.
Fixed issue where failed async operations weren’t getting released from the async operation cache.
Sounds like we may now have that issue back specifically for DownloadDependencies. We’ll look into it.
One note on the fact that you posted this 6 weeks ago. We try to stay on top of the forums, but it’s really easy for things to slip through the cracks here. If it’s a legit bug, please file it through the bug tracker as we can’t really miss those.
Hi ,
how to catch the exception due to no network connection in addressables. in the console i got the error Exception encountered in operation Resource(bundlepath RemoteAssetBundleProvider unable to load from url , is there a way to catch this error so that i can show the user no internet popup screen.
Hello, I am facing a similar issue of needing to handle internet connection loss reliably to display a popup to our users. Any news on it ? Or baring that, would anyone know of a good workaround ?(Application.internetReachability is not reliable enough)
@NicolasBasilGerard
What we ended up doing is basically saying “internet issue” whenever addressables fail for whatever reason. We just check the operation handle status and if it’s failed, we trigger a popup. Far from ideal, but gives out a clear message to the user.
EDIT:
I strongly recommend NOT to use Addressables.DownloadDependenciesAsync function as it seems to cause a bunch of issues (invalid handle, load failing with dependencies exceptions etc). We just load the assets directly without downloading dependencies first.
I opted for a similar solution for now
I do use DownloadDependenciesAsync for preloading some things and it seems to behave as expected (I usually release the handle immediately after completion and use a new one to actually load the bundle)
That is unexpected, when happens when you do a LoadAssetAsync will be that it first loads dependencies and then if they are successful will load the Asset. For DownloadDependencies, it will do the first step (downloading bundles). Skipping the loading step. If there are issues when using DownloadDependencies then there would occur when using LoadAssetAsync.
We have some documentation about how to handle connection issues here AssetBundle Loading | Addressables | 1.20.5 This shows how to get the error and what errors could occur
I’m currently having a similar problem, however I’m wondering, If my assets are already downloaded. It is logical that if it fails to check with the server the latest assets, it should grab from the existing cached/ previously downloaded assets.
Currently even if my assets has been downloaded, in the first run, the app won’t run again unless I allow internet connection to be enabled. Am I missing something here?
Also kindly note that I’m deploying unity app/game as a plugin targeting iOS/Android
Above is the issue I am facing too. First time of Downloading remote assets, everything works fine in the game. Even when switching scenes back and forth. All assets would get load up fine. But next time when game is restarted, It would again look for Internet connection and won’t load any asset until Internet allowed. As if it was downloading the content again. Any way to make game work offline after first time of downloading Addressables?