2
\$\begingroup\$

I plan to use sprite atlases for my 2D game. All my animation is sprite animation so I'm going to use sprite atlases for my characters' sprites.

My question is, if I put the same sprite in two different atlases, how does Unity decide which atlas to load?

EX: I have a sprite atlas per level that contains the background for that level. Sometimes, there's space left over in the atlas. So, if I want to put a sprite, which already exists in another atlas, in the empty space for that level's atlas, how does Unity know not to load both atlases?

\$\endgroup\$
0

1 Answer 1

3
\$\begingroup\$

It picks one randomly. In fact it gives a warning when you have a sprite in multiple atlases, telling you to not do that.

See here for relevant details: https://docs.unity3d.com/Manual/SpriteAtlasScenarios.html

You’re looking specifically at scenario 3 on that page:

Scenario 3: One Sprite in two Sprite Atlases

  1. Sprite Atlas A and Sprite Atlas B both include Sprite 1 in their Objects for Packing lists.
  2. Both Sprite Atlas A and Sprite Atlas B have Include in Build enabled.
  3. Both Sprite Atlases have different Texture output settings in this example.
  4. Result: The Project’s published build includes both Sprite Atlases. Unity randomly chooses which Texture to render Sprite 1 with, in an internal process that is out of your control.
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Thanks so much for sharing that. I don't know how I missed that! \$\endgroup\$ Commented Oct 25, 2020 at 18:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .