This is a tutorial on how to use the TexturePacker extension for Unity. There are two different versions of TexturePacker – The stand alone TexturePacker, and the TexturePacker Unity Extension. Both have a limited function free version in addition to the full version.
Basicly tutorial is splitted in 3 parts.
- Introduction
- Using with 3D object’s (animation, automatic UV)
- Using with GUI (drawing GUI textures from Atlas, GUI Animation)
Introduction.
Why you should use texture atlases in your game:
- Reduced build size
- Reduced RAM consumption
- Increased performance
Why use TexturePacker?
TexturePacker will allow you to easily and quickly create texture atlases for your game.
- Rotation
- Trimming / cropping
- Scaling
- Smoothing
- Note: Some features are not available in the free version
Learn More here:
Why use the TexturePacker Unity Extension?
Unity GUI
- Draw textures from the atlas
- Supports TexturePacker features (rotation. crop, trim)
- GUI animations
3D object
- Auto generation of UV coordinates for Meshes
- Rotated images for optimal space
- Play animations from atlas
- Preview in editor mode
Using with 3D objects
TexturePacker is available for download here:
The TexturePacker Unity extension is available here:
Free
Paid
Creating the Texture Atlas:
For the first tutorial, we’ll pack textures for our scene (Assets are available in the TexturePacker Extension package under Assets/Extensions/TexturePacker/Tutorial/Art/AtlasSource).
Open TexturePacker, and simply drag the textures inside. Now let’s configure our atlas.
Output Options
Data Format: Unity3D
Data File: YourProject/Assets/Resources/TutorialAtlas_data.txt Texture File: YourProject/Assets/Resources/TutorialAtlas.png
Texture Format: png
Geometry Options
Check the “Force Squared” toggle
Layout Options
Algorithm: MaxRect (Full version only) or Basic (available in the free version)
Allow Rotation: checked (Full version only) unchecked (free version)
Trim mode: none (Trim mode is only supported for GUI rendering)
Note
I has described most optimal options, but you can experiment with TexturePacker option to get the best result for your atlas.
Next, press the Publish button. Your altas should look like this:
Free version:
If you do not see the image, you can view the image by clicking directly on the URL
Paid version:
If you do not see the image, you can view the image by clicking directly on the URL
Atlas is ready, so we need material for it.
In Resources Folder Create->Material. Set material name as TutorialAtlasMaterial, attach TutorialAtlas.png as main material texture and change shader to Transparent->Diffuse.