Building Atlases

The appearance of your controls is defined by associating a texture with each of the control's states. For performance reasons, you want as many of your controls as possible to share a single material, and that means they must also share a single texture atlas. Building your atlases is a step that takes all of the textures used by all controls that share the same material or Sprite Manager, and packs them together onto a single texture.
To build your atlases
  1. Make sure all of your sprites/controls have been assigned a material (for unmanaged sprites/controls) or a Sprite Manager (for managed sprites/controls). All sprites/controls that share a given material will be combined onto the same atlas. This is how you control to which atlas a control's textures get packed.

  2. Click Tools->A&B Software->Build Atlases

  3. Select the options you wish to use (see table below for explanation of options) and then click "Create".
Atlas Folder
The name of the folder under \Assets into which the newly created atlas images will be saved. If this does not already exist, it will be created.
Max Atlas Size
The maximum dimensions of the generated atlas.


If the content you attempt to pack into this atlas cannot fit into a texture of this size, they will be automatically resized to fit (with a major loss in quality).
The number of blank pixels to place between each image on the atlas. This helps reduce "bleed" around the edges if using filtering or mipmapping.
Trim Images
When checked, all "empty" space around the edges of each source image will be trimmed away, but the location of the image within the original "frame" will be preserved (use TEXTURE_OFFSET anchor method). This not only helps to save a lot of texture space, it also gives you the ability to use the placement of the original image within its canvass to control the placement of the sprite itself relative to its GameObject's origin. For more details, see the Texture Trimming section below.
Force Square
Forces the resulting atlas to be square. This is useful if you plan to use PVRTC compression, for example, which requires that a texture be square.
Scan Project Folder
When checked, the project folder will be scanned for prefabs containing sprites/controls, and these will be included in the constructed atlases.


When using Unity iPhone 1.7, the behavior of this feature is different than when using other versions of Unity in the following way: When enabled, ONLY the project folder will be scanned and sprites/controls in the current scene will not be used when creating the atlas(es). When using this feature in Unity iPhone, make sure all of the sprites in your scenes are tied to a prefab in the project folder. When doing this, make sure to only make modifications directly to the prefabs themselves and not to the instances in any particular scene as doing so will cause the scene instance to "override" the prefab, and it will not be updated with the new UVs, etc.

Texture Trimming

The "Trim Images" feature of the atlas builder can not only save you atlas space and texture memory, but also gives you an easier way to control the positioning of your sprites. The way it works is it "trims" away any unused transparent areas from your texture when placing it onto the atlas, but preserves the location of the texture information relative to the center of the original texture. Let's look at an example to get a clearer idea of how this works.
Here we have our original image depicting a flower. Note the center of the texture, as marked in the illustration. If this image were to be packed to our atlas as-is, there would be a tremendous amount of wasted space in the upper-right, lower-left, and lower-right quadrants of the image as these are completely empty (transparent). However, using conventional techniques this is what we would have to put up with if we wanted, for example, an animation this flower waving left and right in the wind, whilst its stem remains firmly anchored in place.
Here is the resulting atlas that is built from the above image when Trim Images is enabled. Note that the "empty" space above and to the right of the flower is only there because the atlas must be a power of two in each dimension. If we had additional graphics to add to our atlas, it could fill this space.
This image illustrates how the sprite is positioned relative to its GameObject's center. As you can see, the GameObject is exactly where the center of the original texture was. Also note the light blue lines which show the wireframe mesh of the sprite itself. This clearly shows that only the "occupied" portion of the original texture is being used and the empty parts have been trimmed away. What's more, if this were an animation where the flower swayed back and forth, we would see this mesh change shape and size accordingly.

NOTE: For the original positioning information relative to the GameObject center to be used, the sprite/control must have its anchor method set to TEXTURE_OFFSET. This is the default.