Giter Site home page Giter Site logo

spriteslicer's Introduction

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.
    • 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.