Version: 2023.2
Language : English
Late Binding
Sprite Packer Modes

Resolving different Sprite Atlas scenarios

The way Unity resolves the interaction between Sprites and SpriteA 2D graphic objects. If you are used to working in 3D, Sprites are essentially just standard textures but there are special techniques for combining and managing sprite textures for efficiency and convenience during development. More info
See in Glossary
Atlases depends on various conditions. The examples below detail the most common scenarios:

Scenario 1: Basic Sprite Atlas usage

  1. Sprite AtlasA utility that packs several sprite textures tightly together within a single texture known as an atlas. More info
    See in Glossary
    A
    contains Sprite 1.
  2. Sprite Atlas A has Include in Build enabled.
  3. Result: The Project’s published build includes Sprite Atlas A. Sprite 1 renders with the Texture from Sprite Atlas A.

Scenario 2: ‘Include in Build’ is disabled

  1. Sprite Atlas A contains Sprite 1.
  2. Sprite Atlas A has Include in Build disabled.
  3. Result: The Project’s published build does not include Sprite Atlas A, and does not include Sprite 1’s Texture. Sprite 1 appears invisible in the build at run time, because the Texture it refers to is not available and is not loaded.

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.

In this scenario, to ensure that the Sprite renders with the Texture from the Sprite Atlas you want, follow the steps below:

  1. Disable ‘Include in Build’ for both Sprite Atlases.
  2. When you initialize the Sprite at run time, request the Sprite directly from one of the Atlases with SpriteAtlas.GetSprite. This ensures that Unity always draws the Sprite Texture from the correct Sprite Atlas.
Late Binding
Sprite Packer Modes