(most likely) Addressables bundles do not load in build no matter what I do, and they are huge sized

Hey folks! I have 2 strange issues with addressables:

1. For my project the addressables just won’t work, I built addressables on player build, still not working, i build addressables after player build, still not working. They just won’t show in build, no errors that keys are missing or anything. Build was completed, they are in the build folder/GameName_Data/Streaming Assets but they just don’t want to show in build.

I have tried the addressables-samples-master package too, i built it in 2023.1.7 and 2023.1.8, it didnt work, addressables wouldnt show in build, then I switched to 2022.3.7, where the addressables-samples-master package works, it builds the bundles and the bundles show in build. After I saw it works in 2022.3.7 i used this unity version to open my project too, and unfortunately it still doesnt work for my project. Addressables just won’t show in build :frowning:

Any ideas on this?

2. Addressables have an unexplainable high size after being built.

SS here: https://gyazo.com/0c1237738cedcf2afe1b5209108ce27a

275.4 mb, it doesnt look like it has dependencies other than the shader, material and a few textures.

while the whole folder’s size in the project is:

SS here: https://gyazo.com/5ae8a6603fbc8dfc283cc9f6abd8753a

Would you assist me in figuring out what bugs this out please? I am on a very late schedule, its been a month since i am switching editor versions, addressables versions and doing 36 hours first builds (no joke) and 6 hours 2nd builds to no end. I’m sorry I dont mean to sound entitled, I’m just exhausted and at the same time I’m watching my game die while I just do endless builds with no end. I wouldn’t start this addressables journey but my game at the current time has a big number of guns, attachments and 500+ skins (3 textures each material) and, well, I wasn’t fully aware that everything that is referenced will load into ram, and that made people say our game was a crypto miner because the game would eat much ram, boot up in 10+ minutes, especially on HDDs but on some SSDs too, or not start at all if the page file wouldnt be 20gb.

I will be forever in your debt for your help! Thank you!

Can you show a screenshot of one of the group’s settings that has a lot of assets in them? On Windows, it can happen that certain settings will push the built asset bundles onto a path on your system that becomes too long, which will not make them copy over properly anymore in a player build. If you’re using either the Filename or Append hash to filename options on the Bundle naming mode setting, your paths can become extremely long which can cause this issue to happen. I have it set to Use hash of filename because it’s the most stable and fastest option, and will produce just bundles files in the build root directory, keeping paths pretty short.

Additionally, can you check that the content is also actually built and available on your system prior to making a player build? It should be in your project’s library folder: Library/com.unity.addressables/aa/[PlatformName]. You should see some files in there, and another folder with the build target name that should either contain a lot more sub folders and/or a bunch of asset bundle files. If that’s not there, then no content has been built yet, or it is either running into building issues (check your console).

I personally never used the option to build on player build, but building content after the player build is not proper procedure. When the player build is about to finish, it will look for Addressables content in a certain place and copy it over. If there’s no content to copy over, then no content will be included.
I have a custom build pipeline that automatically builds Addressables explicitly first and then the player build.

Well I thought of the long path too, but i believe thats not the issue.

I once tried to manually copy over the built addressables to the build folder and i got the path too long error. However, I fixed the long name and its all good now.

The addressables do build in library and are copied in player build. I did mention it, they are there in GameName_Data/streaming assets/aa but they just dont show in build (by show i mean they are inexistent, i cant see them in the actual game).

For example I have a scene called Login, that is loaded right after my first scene, which is not an addressable scene.

So i have my PreLogin, which is not an addressable scene, which has a script that just calls Addressables.loadsceneasync to load the Login scene, which is an addressable scene. The game doesnt error, i dont get an error like “cant find scene with key Login”, the game just hangs there. It cant find the scene or whatever is happening exactly, it finds it or not (no invalid key error, it is there!) But it doesnt load it.

Same goes for all other prefabs (weapons and attachments), no invalid key error, but they dont exist in the game.

So from this i can draw the conclusion that the addressables are found, since no invalid key error, they also exist in the build folder/gamename_data/streaming assets. But why dont they also load is what i dont understand. They surely are found but they dont load/show in the actual game.

Here is a screenshot of one of the groups settings (all others are the same):

Additional information: Screenshot - 8978996be64fe9011516df1e93f8950a - Gyazo

This is the player log, as you can see i have 2 debugs, 1 is placed right before addressables.loadsceneasync, one is placed right after (that one is missing from the screenshot), in the same LoadScene function.

As you can see we see both debugs, no error that addressable key is invalid, just the debugs and nothing else, the game just hangs there, player log doesnt log anything else further, its blank.

I would still set the bundle naming mode to use Use hash of filename to completely eliminate this issue and not let this depend on chance or some fiddling with paths.

Apart from that, I don’t see anything obviously wrong. For reference, these are the settings I use on almost all of my groups (except for the groups that contain my scenes - they have Bundle Mode set to use Pack Seperately):

Roger that! Thanks for the advice, will definitely use hash of filename.

Well my 2 problems still stand, can anyone from Unity drop any thoughts here? It definitely looks like a bug. (Apologies for the ping if it’s not allowed @davidla_unity @unity_bill )

@LuGus-Jan what’s your opinion on 275mb sized bundle for just one material that was set to addressables, and has 3 or 4 textures at most, worth 30mb, but bundle size is 275mb?

Can you post the information of the 275MB bundle in build layout? It should contain the details about the sizes of the included assets.

Hey! Apologies for the late response, I attached a buildLayout file. I honestly cant see anything related to the size of the assets but I’m also blind most of the time

The way I thought of to find out whats in those bundles and the size of the contents was to actually open the bundle and see whats inside. Not sure how to open a .bundlr file though, other than opening it with the asset bundle browser from Unity, which showed this:

I don’t see anything suspicious here, turns out that bundle has only 3-5 textures and shader references

However, opening the bundle with some other .bundle opener should give me a better look at whats going on. I will look for a way to open them in the meantime

9235356–1290306–buildlayout_2023.08.19.00.35.01.rar (2.67 MB)

Opened the buildlayout*.json with Addressables Report, it seems that the URP Lit shader is duplicated.

You can reduce the size of bundles by setting the duplicated URP Lit shdaer or other duplicated assets addressable excplicitly. This can be done by the built-in tool.

To reduce the size of the shader, you can strip the unused shader variants. Here is the documentation of URP.

Oh dang, it was the shader! Thank you very much my guy! You are legend!

Unsurprisingly (i expected it even if it doesnt make sense) the addressables do show in the game now. Does it make any sense?

Maybe because the addressables i had were a total size of 107 gb?

Well, conclusion for anyone else who may encounter the addressables not showing in the actual game:
-NO IDEA WHY IT WORKS NOW, but do make your shaders addressables and it might work after!

@Alan-Liu I am forever in your debt! Thank you man!

thanks, you are a life saver