Prefabs and Atlases

I use some Addressables bundles with this simplified structure:
-Sprite
-Prefab that has reference to the mentioned Sprite

In my scene I instantiate the Prefab and it shows itself with the Image component that has this Sprite applited.
Everything works as expected here, no issues.

Now, as I want sprite texture to be compressed, I just want to wrap it in SpriteAtlas. So, the new structure is:
-SpriteAtlas
-Prefab that still referencing old Sprite.

And the sprite is not included in Addressables bundle, as I understand we need only atlas here, so no duplication. But with this configuration now the referenced sprite in prefab Image component shows as white = not loaded.

I also have thought, that maybe I could include actual sprite to addressable bundle, so the structure would be:
-Sprite
-SpriteAtlas
-Prefab that is referencing Sprite.

And as I just load prefab in memory all its references would be resolved automatically, as all they are still within bundle. But no, this still shows white instead of my sprite.

This appears only on built version, in editor everything is always fine.

What have I missed?

you’re missing Sprite Atlas Late Binding. Register the callback and use Addressables to load your atlas and call the provided callback when done. Beware: There be dragons in unity’s sprite atlas system

just found an issue related to that method Addressable Sprite Atlases and as I also prepare and release assets all the time that doesn’t sound viable to hold them always in memory or lose the reference on second time.
Anyway thanks!

1 Like