I Made a Batch Sprite Animation and Library Creation Tool for Unity
Tags: tooling, gamedev, automation, animation
Published: 2024-03-17 09:27:32

Recently, I’ve been playing around in the Unity Engine. Usually, for my own personal projects, I’d usually turn to Unreal Engine or Godot — but once I started creating in Unity, I fell in love! The one thing that bothered me is how long it takes to create 2D animations — especially if you have a spritesheet with multiple animations, or character spritesheets who follow the same layout.

Because of this, I decided to make my own tool to help solve my own problem. [SpriterNator](https://github.com/christinec-dev/SpriterNator) is a Unity extension that simplifies the process of generating and managing 2D sprite animations and sprite libraries. This tool makes it easier to create, organize, and export sprite-based assets within the Unity ecosystem.

![Preview of SpriterNator — where you can create animations and sprite libraries](https://cdn-images-1.medium.com/max/3832/1*rwEUG7HtQlyc4FQT36E4ng.png)
_Preview of SpriterNator — where you can create animations and sprite libraries_

With this tool, you can batch create and manage Animation assets and Sprite Library assets — which will help reduce development time, allowing you to focus on the creative aspects of game development! 😊

**You can find the package and the repository that I created for it below:**
- [GitHub](https://github.com/christinec-dev/SpriterNator)
- [GitBook](https://oops-i-devd.gitbook.io/christinec-dev)
- [Join My Discord](https://discord.gg/4N6b4bkC8h)
- [Support Me](https://ko-fi.com/christinedevs)

---

## FEATURES

### Batch Animation Creation

Automatically generate multiple animations from a single spritesheet, reducing manual setup time. Define animations using start and end frames, and export them as Unity Animation Clips (.anim).

### Sprite Sheet Swapping

Effortlessly switch between spritesheets that follow the same layout. This feature is for developers working with characters or objects that have multiple skins or states, enabling quick swaps without needing to adjust frame ranges or manually creating or dragging animations.

### Animation List Management

Add, remove, and duplicate animations directly from the tool’s UI. Organize your animation sequences efficiently, with support for reordering through intuitive controls.

### Save and Load Presets

Save your animation settings as JSON files for future use. This functionality allows for easy reapplication of animation sequences to new spritesheets, significantly speeding up the development process when working with multiple characters or assets.

### Sprite Library Asset Creation

Streamline the organization of sprites into categories and labels by creating Sprite Library assets directly from your animations. This feature organizes sprites based on animation names and frames, facilitating quick access and reuse within your projects.

---

## USAGE OVERVIEW

### 1. SpriteSheet Preparation

This tool works with spritesheets, so whether you are using it for one simple spritesheet, multiple spritesheets, or a large collection of spritesheets that follow the same layout or pattern (such as for a character creator system), make sure that:

- You split your sprite sheets.

- When splitting the sheets, ensure that each frame is cropped out correctly.

![SpriterNator](https://cdn-images-1.medium.com/max/2184/1*ETG02QUcsHCGtIWkn486hA.png)

![Example of my character spritesheets, which contains two seperate character sheets that are split. You can see they follow the same format and layout.](https://cdn-images-1.medium.com/max/2000/1*xCOHNaTrGlpafBBIpAShBQ.png)
_Example of my character spritesheets, which contains two seperate character sheets that are split. You can see they follow the same format and layout._

### 2. Download the Package

- [Download](https://github.com/christinec-dev/SpriterNator/tree/main/Package) the package.

- With your project open, double click the package file to add it to your project.

- Once added to your project, you should be able to see it in your project via Tools/SpriterNator.

![SpriterNator](https://cdn-images-1.medium.com/max/7040/1*24kHEQT6tt7ftP8yq_vU8A.png)

### 3. Adding Animation Properties

- Select the spritesheet (not the individual frame, the complete spritesheet) asset that you want to use to create animations.

- Also set the location to where your assets should save.

- If you plan on creating a Sprite Library asset from your animations, add a name for this asset.

![SpriterNator](https://cdn-images-1.medium.com/max/7040/1*rdJeIUBLt1h5JBMT4oJN6Q.png)

![f](https://cdn-images-1.medium.com/max/7040/1*5qi8MVzErULUcyBdO7hpyQ.png)

### 4. Create Your Animations 

- You can **add** animations to the list via the “+” button.

- You can **remove** animations from the list via the “-” button.

- You can **duplicate** list animations via the “++” button.

- When creating an animation, enter the first frame, last frame, and frame rate of your animation. Also state whether or not it should loop.

- You can find the first frame value on your spritesheet at the end of the frame naming “_x”.

- You can find the last frame value on your spritesheet at the end of the frame naming “_x”.

- The frame rate is added automatically, but you can change it if you want.

![SpriterNator](https://cdn-images-1.medium.com/max/7040/1*AYYhaxSe_k9qEKGZm2ZfMw.png)

![SpriterNator](https://cdn-images-1.medium.com/max/7040/1*Suq4MexPOZJnTV8tzlHl4Q.png)

![SpriterNator](https://cdn-images-1.medium.com/max/7040/1*fnme-ZPPrGbOir0gAIvODA.png)

![SpriterNator](https://cdn-images-1.medium.com/max/7040/1*G-TyrLfmvx8sfDtw-9AVNw.png)

![SpriterNator](https://cdn-images-1.medium.com/max/7040/1*f4M_HD67RGTk9XqhjPokDg.png)

![SpriterNator](https://cdn-images-1.medium.com/max/7040/1*ni9fmAx1hRei_82mX2iRfg.png)

![SpriterNator](https://cdn-images-1.medium.com/max/7040/1*Kn5garV9zfP0HGHT-LtHBA.png)

### 5. Export Your Animations

- When you’ve created your animations, and you want to export them as .anim assets, click the “CREATE ANIMATIONS” button.

- You can go to the directory where you saved it, and the animations should be there. The tool automatically focuses on this folder for you.

- Then, you can add your character to your preview panel, and test the animation.

![SpriterNator](https://cdn-images-1.medium.com/max/7040/1*7JHsEkkqTVi5rLyI9diuYg.png)

![SpriterNator](https://cdn-images-1.medium.com/max/7040/1*gW02jTED7WPSReQserKFCw.png)

### 6. Create Your Sprite Libraries

- When you’ve created your animations, and you want to export them as .asset assets, click the “CREATE SPRITE LIBRARY” button.

- Your animation names will be assigned as **Categories**, and your animation frames per animation will be assigned as **Labels **to these Categories.

- You’ll have to convert the runtime asset that it created into a library asset. Select the asset, and in the Inspector Panel, click on “Open Sprite Library Asset Upgrader”.

- Load your created library asset, and upgrade it.

- Your Sprite Library should now be created.

![SpriterNator](https://cdn-images-1.medium.com/max/7040/1*EDCk6ikAsdRp6kyK1aDIsg.png)

![SpriterNator](https://cdn-images-1.medium.com/max/7040/1*J062NYLgyeMBs5LQjgnoKA.png)

![SpriterNator](https://cdn-images-1.medium.com/max/7040/1*2185UlCq34VVWZCMHkaA7A.png)

### 7. Export & Import Your Animation Lists

- If you have similar spritesheets, and you’d like to come back later to create animations for another character using the same animation frames and naming conventions, then you can save your animations as a JSON file via the “SAVE LIST” button.

- You can edit this file to add more animations, and then load it again using the “LOAD LIST” button.

![SpriterNator](https://cdn-images-1.medium.com/max/7040/1*gaDbojttZX4vSmbLyXoh0g.png)

### 8. Reuse Your Created Animations

- If you have similar spritesheets, and you want to create the same animations for Character_2 as you did for Character_1, then you can simply just drag in your new spritesheet into the properties panel, and change your naming and/or save location of the asset.

- Simply click “CREATE ANIMATIONS”, and your new character will have the same animations!

- This assumes that they have the same spritesheet and animation layout.

![SpriterNator](https://cdn-images-1.medium.com/max/7040/1*OIUmNWY2dHxV2x9j5_lJsw.png)

![SpriterNator](https://cdn-images-1.medium.com/max/7040/1*ohDmt2vfU3dFFoADCKXJUw.png)

---

And there you have it! I hope this tool saves you some time when creating 2D animations and Sprite Libraries in Unity —  because I know that it’s saving me time. I might add to it later on, and if so, I will update this post. Until then, happy developing! 😊