In 2022.2.xx WebGL builds, GetDownloadSizeAsync does not reflect the cache.

We were using unity 2021.3.2 and recently upgraded to 2022.2.18.
addressables@1.21.12 also upgraded to the latest version

In WebGL builds, the previously working GetDownloadSizeAsync is not returning a zero result, even though it is already cached.

We are currently trying to determine if GetDownloadSizeAsync should be used to download the bundle or not.

But if we use DownloadDependenciesAsync, we get
“[UnityCache] ‘https://xxxxxxxxxxxxxxx/abc.bundle’ successfully revalidated and served from the indexedDB cache”, we can see that it’s reading from the cache without actually downloading.

I know that 2022.2.18 changed the indexedDB structure, so maybe GetDownloadSizeAsync doesn’t reflect the cache?

I ask for help.

2 Likes

Hi @haling79 yes starting in 2022.1+ WebGL bundles use the browser cache instead of the UnityEngine.Caching class. In this case GetDownloadSizeAsync does not know if the bundle is cached.

Hi @pillakirsten
We too were using the return value of the GetDownloadSizeAsync method to determine if there is a cache.
Is there any way to check if there is a browser cache other than the GetDownloadSizeAsync method?

Environment:
Unity 2022.3.2f1
WebGL platform
Addressables 1.21.12

1 Like

some updates? I found that bug also 2023.1.16f1…

We have the same issue. Not only GetDownloadSizeAsync returns full download size (as if nothing was in cache), it sometimes returns double of that (when our game reloads, for example).

On top of that, Addressables does not know when catalogs change on remote because it doesn’t store the local hash for the catalog file. We had some code that acted differently when catalogs were updated, to unload all AssetBundles that were in use to be able to reload the catalog with updated bundles.

Nowhere in the release notes (Addressables or Unity editor) or documentation this is mentioned. So basically there is a completely broken feature for WebGL… which I think is one of the main platforms for Addressables as you really want to minimize the bootstrap player and download all assets on the background…

We can live with the GetDownloadSizeAsync being broken for WebGL, but the catalog issue is quite annoying to circumvent.

1 Like

Hey guys. Did you find the fix for this?
Thank you

1 Like

Hi @pillakirsten
Now how do we know if the bundle is cached?

Totally agree with @SampsaPlaysome. Seems like the issue still exists.

My problem: bundles from addressables are re-downloading for every prefab that I instantiate.

Is this a known issue? Will this be addressed? I read the Manual on Chaching that you linked. @pillakirsten

Im in Unity 6 preview, Addressables 2.2.2. Web build using WebGPU.

We ended up forking the Addressables package and modifying the code so that the catalog hash is stored and survives the page reload. We have needed to do considerable amount of bug fixes and changes to get the system to behave predictably in our game where the catalog is being updated frequently.

1 Like

thank you for updating us on your approach!