Hey everybody.
I’ve written a TexturePacker import script for use with the new Sprite system introduced in Unity 4.3.
The script is available here.
(If you’re unfamiliar with github, you can click the “Raw” button to get to the raw C# file and then save it to disk from your browser.)
Usage:
- Add the script somewhere inside your Unity project Assets folder. (I use Assets/Scripts/Importers)
- Export an atlas and texture from TexturePacker into your project. Use the png and generic xml formats. (Don’t check “Allow Rotation.”)
- Profit
It looks like the SpriteRenderer references the sprites by index, so if you delete a texture from your atlas, when Unity reimports, I fill the gap with a sprite named “DELETED_SPRITE_#.” New textures are added to the empty slots first.
The script (like all of the files in my UnityTools repo) is public domain, so you’re welcome to use it however you like. If you see a way I can improve it, I’d love your feedback.