Modified 2D Aseprite Importer
A custom modification of com.unity.2d.aseprite that allows you to import palettes from Aseprite and replace them during runtime.
com.max05643.aseprite Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/max05643-aseprite.git README Markdown
Copy this to your project's README.md
## Installation
Add **Modified 2D Aseprite Importer** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/max05643-aseprite.git
```
[](https://www.pkglnk.dev/pkg/max05643-aseprite)Dependencies (4)
README
A custom modification of com.unity.2d.aseprite that allows you to import palettes from Aseprite and swap them at runtime.
- Saves video memory
- Dynamically changes the appearance of sprites using different palettes without storing separate sprite variants
Motivation
Aseprite allows you to use Indexed Color mode and switch between different palettes without modifying the sprite itself. If a palette contains fewer than 256 colors, it is possible to recreate this technique in Unity.
In this approach, the imported sprite sheet becomes an R8 texture that encodes color indices, while a separate palette texture is used as a lookup table. If your sprite sheet is large enough, this can significantly reduce video memory usage. Multiple palettes can also be combined into a single lookup texture and switched at runtime by changing a shader property.
This plugin modifies com.unity.2d.aseprite to allow developers to take advantage of this technique.
Installation
Open Window → Package Manager.
Click + → Install package from git URL.
Enter https://github.com/Max05643/com.max05643.aseprite.git, then click Install.
Workflow
- Create an Aseprite file using Indexed Color mode. The palette must contain fewer than 256 colors.
- Create several palettes for the file and export them as
.pngfiles. Change their extensions to.palette. - Import all palettes into Unity.
- In your project, create a palette collection: Create → Aseprite → Palette Collection.
- Assign the individual palettes to the palette collection.
- Import the
.asefile into Unity. Set Palette Interaction Type to Use External. Assign your palette collection to Palette List. Assign one of the built-in palette shaders (URP or Built-in RP). - Use the automatically generated prefab.
- In your scene, add the
PaletteDynamicChangerscript to the prefab instance. - Assign your palette collection to
PaletteDynamicChanger. - Change
currentPaletteIndexand enter Play Mode. - Alternatively, use the public
ChangePalettemethod inPaletteDynamicChangerto switch palettes at runtime.
You can also use multiple PaletteDynamicChanger components on a single prefab instance if you need to change palettes independently for each imported Aseprite layer. See the Samples for an example of the correct setup.
Import modes
This modification adds two new import modes to the .ase importer: Create From File and Use External.
Create From File
Automatically creates a palette from the .ase file if fewer than 256 unique colors are used. This mode is useful for testing.
Use External
The primary mode intended for production use. You must create a palette list asset and assign it in the importer settings. You can then use PaletteDynamicChanger with the generated prefab to dynamically switch between palettes from the assigned list.
Scriptable Pipelines Support
- Universal Render Pipeline is supported. The shader supports the SRP Batcher. URP is strongly recommended.
- Built-in Render Pipeline is supported, but GPU instancing does not work. You may use it as is or modify it further if needed.
No comments yet. Be the first!