Releasing Bundles in WebGL

Hi,

I’d like to be able to update bundles at runtime in WebGL. My process works for a standalone build but not in WebGL.

  • [Editor] Build bundles and push them to S3
  • [Web Build] Load the bundle and instantiate the gameobject into the scene from s3 using addressables.
  • [Web Build] Destroy the gameobject and release the bundle using addressables.
  • [Editor] Modify on of the prefabs and updating the bundles, pushing the new bundles and catalog to S3.
  • [Web Build] Update the catalog and reload the bundle from s3 with addressables. → the same prefab loads
  • [Web Build] Clear browser cache and refresh page
  • [Web Build] Load the bundle with addressables → the updated prefab is instantiated

This process works just fine in a windows standalone build so it should work i think.

I’m using Graphy to profile the memory usage, and the memory goes down when I release the bundle:6839876--796034--upload_2021-2-15_15-18-40.png

(the browser heap allocation remains high though, maybe its still cached??)

I suspect that perhaps this is a browser caching issue?

I know that there were problems with releasing assetbundles from memory pre-addressables, but I thought that part of the point of addressables was to make freeing up memory more manageable.

I’ll kick this over to the team to share some insight.

Ah thank you for the response! :slight_smile:

Hmm interesting. You could try adding a call to Resources.UnloadUnusedAssets to see if that frees up the memory. If not, it may work for you to disable bundle caching for now. There’s been some issues around caching Addressables in WebGL that we’ve been looking into recently and I’ll make a ticket for this and add it to my list. What version of Addressables and Unity are you using?

1 Like

Update to this issue, I haven’t been able to reproduce this problem on my end. Hosting on S3, I just refresh the page and the content is updated. Some other things to try:

  • You could disable Data Caching under Player Settings > Publishing Settings > Data Caching, which disables WebGL caching and relies only on browser caching.
  • Also under Addressables group settings > Content Packing & Loading > Advanced Options > Cache Clear Behavior could change to Clear When New Version Loaded.
  • You could also try disabling AWS S3 versioning, if you have that enabled.

If you still see the issue, would you be able to file a bug? It would help to see your project and settings.

1 Like

Heya, thanks for the response! I’m gonna try these suggestions out!