Skip to content
Unity extension for reusing sprite texture areas
Branch: master
Clone or download
Latest commit f4f8dae Feb 14, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Assets update third party Feb 14, 2019
Packages update project version Jan 27, 2019
ProjectSettings
.gitattributes
.gitignore initial commit Sep 21, 2017
LICENSE
README.md

README.md

Download package

For Unity 2018.1 and later: SpriteDicing.unitypackage. Check releases for previous versions support.

Please be aware that you don't need to clone the whole repository in order to use the extension in your project. Either download package from the link above or extract Assets/SpriteDicing folder from the repository project – it contains all the required assets; other stuff is just for testing purposes.

.NET 4.x scripting runtime is required. Make sure to configure the project before importing the package.

Description

Sprite Dicing is an editor extension for Unity game engine which allows to split up a set of large sprite textures into small chunks, discard identical ones, bake them into atlas textures and then seamlessly reconstruct the original sprites at runtime for render.

This technique allows to significantly reduce build size, in cases when multiple textures with identical areas are used. Consider a visual novel type of game, where you have multiple textures per character, each portraying a different emotion; most of the textures space will be occupied with the identical data, and only a small area will vary:

These original five textures have total size of 17.5MB. After dicing, the resulting atlas texture will contain only the unique chunks, having the size of just 2.4MB. We can now discard the original five textures and use the atlas to render the original sprites, effectively compressing source textures data by 86.3%:

By the way, in case you're developing a visual novel, take a look at my visual novel engine, which uses this extension.

How to use

  1. Create a DicedSpriteAtlas asset using Assets -> Create -> Diced Sprite Atals menu command, select it;
  2. Specify Input Folder — project directory, containing the source textures you wish to process. You can simply drag-drop a folder from the project hierarchy window into the field;
  3. Press Build Atlas button and wait for the generation procedure to finish;
  4. Sub-assets will appear inside the atlas asset, representing the original sprites; select any of them and drop to the scene.

You can optionally configure the atlas generation settings via the inspector editor window. Consult the tooltips for information on avilable options.

You can’t perform that action at this time.