I have questions about the method when using addressable

If I load a UI prefab through Addressables, when are the Sprites used in that prefab loaded?

I assume that the Sprites will be loaded at the time the prefab is instantiated and remain in memory even after the prefab is unloaded. Is this correct?

To manage memory efficiently, I’m considering creating an Atlas for all Sprites used in the UI, registering the Atlas as an Addressable, and then dynamically loading the Atlas when the prefab is loaded. Afterward, I would fetch the required Sprites from the Atlas, assign them to the UI elements, and unload both the prefab and the Atlas when they are no longer needed.

However, this approach feels overly complicated. Am I misunderstanding how Addressables or Atlases work in this scenario? Is there a simpler or better way to manage memory while keeping the UI efficient and functional?

Also, with the method above, the complete UI will only appear correctly at runtime since the Sprites are assigned dynamically. How can I handle this situation effectively in the editor for better preview and design workflow?

As the prefab is loaded as they are dependencies.

Their reference count will go down but be aware anything loaded by addressables stays in memory until everything in their respective group is released. But no you don’t need to release any dependencies loaded as part of an addressable asset (unless they’re loaded by addressable references of course).

While the docs make it seem like you should load everything via asset references individually, you really don’t. Addressables handles reference counting fine but because it’s built on Asset Bundles, it has the same limitations (namely the aforementioned requirement of everything in a bundle needing to be released in order to unload it from memory).

The memory management aspects are more useful in terms of larger scale asset management. Such as the content of levels of a particular theme or whatnot, which can all be effectively organised into one group and unloaded when those levels are done.

Otherwise it’s not going to help on a granular level. I would handle those assets normally and use the memory profiler to tackle your real memory issues.

Just keep in mind when using addressables all your assets and scenes should ultimately be organised in asset groups, namely to avoid asset duplication.

1 Like