Skip to content

Tool to export Unity sprite sheet slices as individual images

License

Notifications You must be signed in to change notification settings

fadookie/SpriteSlicer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unity Sprite Slice Export Tool

Background

I wanted a way to quickly slice up spritesheet rips for a game I am working on. Unity's built-in spritesheet editor has some fantastic tools to slice spritesheets automatically. However, at this time of writing there is no built-in way to export the sprites as individual images. This editor script is intended to bridge that gap, turning Unity into an automatic spritesheet-slicing machine.

Installation

This works as a standalone Unity project, or you may copy the Scripts folder into an existing project.

Usage

Pre-Processing

You will get the best results if you pre-process your spritesheet by deleting any unwanted graphics along with the background color if any, and save it as an alpha-transparent PNG. This will help Unity's automatic slicing algorithm, as well as usually being what you want in order to use the sprite in a modern game engine. If you are looking for tools to help do this, I recommend Pixen (macOS), Paint.NET (free, Windows), or GIMP (free, all platforms).

Required Import Settings

Each texture you want to use should have the following import settings:

Property Value Explanation
Texture Type Sprite (2D and UI) This script is only designed to export sliced sprite sheets.
Sprite Mode Multiple "
AdvancedRead/Write Enabled ☑️ Required for exporter to read texture.
DefaultMax Size 8192 (Or highest available) Prevents automatic downsampling of large textures. If your sheet is larger than this (8192 x 8192,) split it into smaller sheets using an image editor first.

Export Steps

  1. Slice your spritesheets using the Sprite Editor.
    • I recommend using the automatic slicing feature and then tweaking if needed.
  2. From the main menu bar, click SpriteTextureSliceExporterExport Slices. (You can also use Export Slices from the context menu.)
    • I wanted this to be in the context menu as well but couldn't get it working. If you can figure this out please send a PR!
  3. Choose a folder to export images to.

Note: I have not tested this on atlases, only spritesheets attached to individual sprite assets as described above.

Credits

Note that the MIT License applies to the code in this repo only and not the spritesheets themselves which are only provided for demo purposes.

About

Tool to export Unity sprite sheet slices as individual images

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages