Can't load the remote built-in data bundles after downloading

I want to pre-download all the updated remote bundles and enable Only update catalogs manually. Here is my approach:

  1. Open a scene with only a GUI panel called PatchMenu to show downloading progress etc.
  2. All the assets the scene used are packed into single bundle call PatchBundle. It’s local and have no references to other bundles except built-in bundles.
  3. Unity generate two built-in bundles for me, one is unitybuiltinshaders, another is monscripts. They both have hash added to their file names, so the real bundle file is such as xxxxxx_monoscripts_xxxxx
  4. Then I call CheckForCatalogUpdates, UpdateCatalogs, DownloadDependenciesAsync … I have managed to make everything works well until one of the built-in bundles is changed.
  5. The changed built-in bundle, take xxxx_monoscripts_xxxx for example, has a different hash appended to its name and get uploaded to ServerData. But when I try to load it (after downloading), I get an error from Addressables The AssetBundle can’t be loaded because another AssetBundle with the same files is already loaded

It looks like that if I’m using a built-in bundle such as xxx_monoscripts_xxx, I can’t load another xxx_monoscripts_xxx anymore, even if they have different file names. I’m not sure if it applies to other non built-in remote bundles. Is this by design, or did I miss something ?

I should point out that I have use a custom InternalIdTransformFunc to redirect remote bundles’ path to streamming assets folder if I could find one inside it. Because I don’t want players to download all remote bundls at first launch. So I put all remote bundles inside streaming assets folder to ship with the application. Once a remote bundle is changed, it has a different file name with appened hash. So it can’t be found in streamming assets folder and will get downloaded. If this approch has any potential to cause problems, please let me know.

Currently the solutions that I’m considering are:

  1. Ask players to reboot the game. Yes, once I reboot the game, everything goes right because the new bundles are downloaded into the cache. But this way is so rude. And when the cache is gone, I will be facing the same problem.
  2. Remove the dependencies from PatchBundle to built-in bundles. I doubt weather it can be done. Because the built-in bundle is a black box, I even don’t know what’s inside and what cause them to be modified.
  3. Try to find out some ways to unload the bundle, or turn to some custom bundle management.

Pre-downloading updated bundles is so a common requirement. It’s hard to believe that it’s so difficult to impelment it right with Addressables. I have searched around in the community and found a lot of related topics but without any lucks. I would greatly appreciate any suggestions you have regarding the issues I’m facing.

My setup does not generate monscripts files. What platform are you targeting?

My setup do this:
In initial build, it generates (hash)_unitybuiltinshaders.bundle and defaultlocalgroup_assets_all.bundle, these files is always included in build and does not get updated remotely, their names are static.

When I want to update remote files, I build Addressable so I can the new catalog file and a bundle file containing new remote files.

Then I upload the new catalog and the remote bundle to my server.
2024-10-11 11 03 45

When the game run, it checks if a remote catalog is available, then it downloads the remote catalog. If a remote catalog is not provided, the game will load addressable locally with built-in bundles.

There’s an option in the Addressables settings. You can choose to generate MonoScript bundle which
ensures that Unity loads all Monoscripts before any MonoBehaviors can reference them.

I found that the built-in bundles derived settings from the bundle which is set as default. Previously I use a remote bundle as default, so the built-in bundle is remote. Now I’m trying to use a local bundle as default so the built-in bundle become local, though I don’t think it’s a solution.

The problem is, should the built-in bundles be updated remotly? If so, how to do that according to my situation (manually update catalogs) ?

Yes, the Addressables is designed to work like this. All remote assets are downloaded on demand. But it may not be a good idea considering complicated network situation. For example, how if players have the catalogs updated then get offline? I prefer to have all updated bundles ready before entering game. And players can also play the game if they are offline or fail to finish the updating.

I’m having same issue with built-in bundles erroring out with " can’t be loaded because another AssetBundle with the same files is already loaded." did you find a solution to bypass this problem? I’m loading 2 catalogues that aren’t built-in

I’ve encountered the same issue during testing and I found that it was caused by previously loaded old bundles.
For example, you got a A_123.bundle and an updated one A_456.bundle. The new one can’t be loaded if the old one is already in used. And I have no idea how to unload the old one.
My solution is to download all the updated remote bundles in advance. I have a Patch scene which only depends on local bundles. In this scene I check catalog updates, download all dependencies. After that, I start the real game scene.