How to check if there is a version of an Addressable Asset cached and load it without updating it?

I tried searching for it on documentation and in the forums but i haven’t been able to get an answer. I apologize in advance if there is.

In my project users will be able to download addressable scenes. But they also should be able to play them without downloading the updates, even if available.

I wanted it to work just like the usual app stores work: Warn users that there is an update but let them open the app even if they choose not to. Also the download shouldn’t be forced.
When trying to do this i ran into a few issues:

  • GetDownloadSizeAsync() will always be greater than 0 if there is an update, and i haven’t encountered any way to check if there is a cached version of it already.
  • Calling Addressables.LoadSceneAsync() is always downloading the new version, even if users already have an older version of it downloaded.

I could workaround the first issue by saving the information in playerprefs, SOs or any other way so it’s fine if there is no native solution available, but i can’t find a way to load an already cached scene without updating it, and it’s really needed.

Project is developed for Android only

1 Like

Hi @RD3_Elizeu by “updating/updates”, do you mean updating the content catalog? If so, in AddressableAssetSettings there is an option to “Disable Catalog Update On Start”. If that option is enabled then Addressables won’t automatically update the catalog when the system is initializing (when it calls InitializeAsync).

So instead you could do CheckForCatalogUpdates to see if there’s a catalog update. Then if the user wants to download the update, you would manually call UpdateCatalogs.

That being said, GetDownloadSizeAsync should be returning 0 if the bundle containing the asset is cached, or is a local bundle. To get a better understanding, you could stick a breakpoint in AssetBundleRequestOptions.ComputeSize directly. You’ll notice that we use the Caching API, specifically Caching.IsVersionCached, to check if a bundle is cached.

Thanks! I made this work but unfortunately it didn’t quite solve my problem because i need users to be able to update only the bundles that they want to.

When i update the catalog and try to load an addressable scene it will download its bundle from the remote path automatically, even if i have a cached version of that bundle.

Is it possible to have an updated catalog but load cached version of assets instead of downloading their bundle update?
Or should i have multiple catalogs, one for each scene?

I see, yeah unfortunately there is no way to “undownload” catalogs. Once the catalog is updated, it will only be aware of the newest version of the bundle. The old version of the bundle that is stored in the cache essentially becomes dead data.

Yes I suppose the best way to do this is to have multiple catalogs, one for each scene. That way certain scenes will be the newest version, while other scenes can still be the older version. You can make as many catalogs as you want as we don’t enforce a limit on the number of catalogs.

Any chance this feature will ever get added? It would be useful to be able to check for an update, but not have it be mandatory once the catalog has been updated. I.e, the flow would be:

  • Update catalogs

  • Present any updated bundles as having an update available in our own app UI

  • Let user decide whether to update or proceed with current cached version (this would require some new parameter in Addressables.LoadAssetAsync to support a “prefer cached version” option.

An option to this workflow would be to provide a way to get detailed data about what assets have been updated, instead of just providing the catalog name itself in CheckForCatalogUpdates. So, a call to CheckForCatalogUpdates would bring down a meta data set containing the bundles that have been updated and their update size.

Any of these solutions (or workarounds to achieve the same result) would be much appreciated!

1 Like

I’ve manage to make this work, I’ve made a repo with the code, but here’s the thread about it where I give more details How to load already downloaded remote catalog without loading remote catalog?

1 Like

Cool, thanks for sharing! For now I’ve decided to build the app around the current behavior but if needed in a future update your solution might come in very handy.