Understanding Addressables Behavior

I’m using Addressables and encountering some unexpected behavior I’m struggling to understand.

  • I initially had the “Use Asset Bundle Cache” option enabled for each of my Addressables.

  • Today, I learned that this option creates a shadow copy of every Addressable asset. As a result, 15 GB of assets require 30 GB of storage—half of it stored in a temporary folder for end users. Not good.

  • When I disable the “Use Asset Bundle Cache” option, the game’s runtime memory usage balloons from 4 GB (acceptable) to 12 GB. Why does this happen?

According to the documentation, the “Use Asset Bundle Cache” property “determines if a bundle can be loaded from the local cache instead of being downloaded, using CRC and hash values."

Since my assets are not downloaded, I shouldn’t have enabled this option in the first place, right? However, disabling it in a build causes a dramatic increase in memory usage.

Does anyone have insight into why memory usage increases when this property is disabled?

Here are the settings I’m using for each addressable:

Thanks,
Shaun

If you ship your assets locally, i.e. via Steam, DO NOT enable the addressable group property Use UnityWebRequest for Local Asset Bundles in Unity 2022.x. Yes, this property fixes loading and deadlock issues for some users, and it might be faster in certain scenarios…

This setting results in the entire addressable group being loaded into memory. So if you have 10GB of assets and they are partially accessed, your game will use 10GB of memory when this flag is enabled.

Here is the difference illustrated. In this scene trees are loaded from one addressable group, terrain heightmaps from another, musical score from another etc.

If Use UnityWebRequest is enabled, the game consumes 7.1 GB of memory!

If Use UnityWebRequest is disabled, the game consumes 3.9GB of memory.

Separately, if Use Asset Bundle Cache is enabled, your game copies assets 1:1 to a temporary folder, consuming valuable disk space. i.e. your Steam page states that your game requires 10GB to install, but the net install size will be 20GB after assets are loaded.

Some of these settings (i.e. Use Asset Bundle Cache) are enabled by default. Many forum posts suggest enabling Use UnityWebRequest.

The documentation does call out these details, but with so many settings exposed, it’s quite easy to misconfigure assets.

Cheers!

2 Likes

Thanks for the info! Just out of curiosity, have you tried using LZ4 instead of uncompressed asset bundles? I believe to remember it improved loading performance in a project I worked on a while back.

1 Like

That’s a great question. I’m happy to try any combination that has a chance of yielding better load times.

My most expensive operation using addressables is planet generation. Here are those timings with and without LZ4 asset bundle compression for all asset bundles. (These timings are total time – they include operations other than loading assets.)

Biome 1, No Compression: Total 4897ms, Area 25km, 195ms per sq km
Biome 2, No Compression: Total 4320ms, Area 25km, 172ms per sq km
Biome 1, LZ4 Compression: Total 6137ms, Area 25km, 245ms per sq km
Biome 2, LZ4 Compression: Total 6555ms, Area 25km, 262ms per sq km

The memory usage looks to be the same for me.

1 Like