Unity 2D Export Pipeline Lossless RGBA Verified 2026-11-25

Pixel Art Sprite Generator and C# Importer for Unity 2D

Direct answer: Celgrid generates exact indexed pixel-art sprites and bundles UnitySpriteForgeImporter.cs inside every pack.zip. Install the C# script once under Assets/Editor/, select sprite.json, and run Assets > SpriteForge > Import animation to automatically enforce FilterMode.Point, TextureImporterCompression.Uncompressed, zero mipmaps, normalized bottom-center pivots, and a looping Unity AnimationClip.
Live Starter Sprites (Nearest-Neighbor)
Frontline Soldier Walk (16x16 indexed pixel art sprite, 6 frames)6f 9fps
Frontline Soldier Walk
16x16 pxwalk
Frontline Grenade Toss (16x16 indexed pixel art sprite, 6 frames)6f 6.7fps
Frontline Grenade Toss
16x16 pxcustom
Crypt Knight Attack (24x24 indexed pixel art sprite, 6 frames)6f 10fps
Crypt Knight Attack
24x24 pxattack
Meadow Village Scout (16x16 indexed pixel art sprite, 4 frames)4f 8fps
Meadow Village Scout
16x16 pxwalk
Why Celgrid fits Unity 2D

Zero post-processing cleanup between generation and engine playback

One-click C# Editor automation (no manual Sprite Editor slicing)

UnitySpriteForgeImporter.cs reads Celgrid's sprite.json manifest, configures every individual frame PNG in frames/, writes normalized bottom-center pivots (x/w, 1 - y/h), and creates a ready-to-play .anim AnimationClip.

Automatic Point filtering and zero compression artifacts

Unity defaults to Bilinear filtering and DXT/BC7 compression, which turns crisp 16x16 pixel art into green/magenta blocks. Celgrid's importer enforces FilterMode.Point, TextureImporterCompression.Uncompressed, and mipmapEnabled = false on every frame.

Consistent Pixels Per Unit (PPU) across entire rosters

Because Celgrid locks exact canvas dimensions per project (16x16, 24x24, or 32x32), your Unity tilemap grid and Pixel Perfect Camera PPU stay aligned without uneven sub-pixel scaling.

Exact frame timing preserved in AnimationClip

Celgrid's importer reads duration_ms directly from sprite.json and sets AnimationClip frameRate, ObjectReferenceKeyframe timings, and loopTime automatically.

Real generated export output

Exact Unity 2D files generated from Frontline Soldier Walk (16x16, 6 frames)

These snippets are produced directly by Celgrid's live exporter (sheet_export.py) — never hand-faked placeholder code.

Assets/Editor/SpriteForgeImporter.cs (Bundled in every Celgrid pack.zip)
// Install once as Assets/Editor/SpriteForgeImporter.cs; select sprite.json from an extracted pack.
using System;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;

public static class SpriteForgeImporter
{
    [Serializable] class Manifest { public Sheet spritesheet; }
    [Serializable] class Sheet { public Frame[] frames; public string tag; public bool loop; }
    [Serializable] class Frame { public string name; public int source_width, source_height; public float duration_ms; public int[] pivot; }

    [MenuItem("Assets/SpriteForge/Import animation", true)]
    static bool CanImport() => Path.GetFileName(AssetDatabase.GetAssetPath(Selection.activeObject)) == "sprite.json";

    [MenuItem("Assets/SpriteForge/Import animation")]
    static void Import()
    {
        string path = AssetDatabase.GetAssetPath(Selection.activeObject);
        string folder = Path.GetDirectoryName(path).Replace('\\','/');
        var sheet = JsonUtility.FromJson<Manifest>(File.ReadAllText(path)).spritesheet;
        var keys = new ObjectReferenceKeyframe[sheet.frames.Length + 1];
        float time = 0;
        for (int i = 0; i < sheet.frames.Length; i++)
        {
            var frame = sheet.frames[i];
            string png = folder + "/frames/" + frame.name + ".png";
            var importer = AssetImporter.GetAtPath(png) as TextureImporter;
            if (importer == null) throw new IOException("Missing frame " + png);
            importer.textureType = TextureImporterType.Sprite;
            importer.spriteImportMode = SpriteImportMode.Single;
            importer.mipmapEnabled = false;
            importer.filterMode = FilterMode.Point;
            importer.textureCompression = TextureImporterCompression.Uncompressed;
            var settings = new TextureImporterSettings();
            importer.ReadTextureSettings(settings);
            settings.spriteAlignment = (int)SpriteAlignment.Custom;
            settings.spritePivot = new Vector2((float)frame.pivot[0]/frame.source_width, 1f-(float)frame.pivot[1]/frame.source_height);
            importer.SetTextureSettings(settings);
            importer.SaveAndReimport();
            var sprite = AssetDatabase.LoadAllAssetsAtPath(png).OfType<Sprite>().Single();
            keys[i] = new ObjectReferenceKeyframe { time = time, value = sprite };
            time += frame.duration_ms / 1000f;
        }
        keys[keys.Length-1] = new ObjectReferenceKeyframe { time = time, value = keys[keys.Length-2].value };
        var clip = new AnimationClip { frameRate = 1000f/sheet.frames[0].duration_ms };
        var binding = EditorCurveBinding.PPtrCurve("", typeof(SpriteRenderer), "m_Sprite");
        AnimationUtility.SetObjectReferenceCurve(clip, binding, keys);
        var timing = AnimationUtility.GetAnimationClipSettings(clip);
        timing.loopTime = sheet.loop;
        AnimationUtility.SetAnimationClipSettings(clip, timing);
        AssetDatabase.CreateAsset(clip, AssetDatabase.GenerateUniqueAssetPath(folder+"/"+sheet.tag+".anim"));
        AssetDatabase.SaveAssets();
        Selection.activeObject=clip;
    }
}
sprite.json excerpt (Frontline Soldier Walk, pixel pivot -> Unity normalized)
{
  "id": "01b956ac6b13",
  "title": "Frontline Soldier Walk",
  "width": 16,
  "height": 16,
  "spritesheet": {
    "tag": "walk",
    "fps": 9.0,
    "loop": true,
    "frames": [
      {
        "index": 0,
        "x": 0,
        "y": 0,
        "width": 16,
        "height": 16,
        "trim": [
          0,
          0,
          16,
          16
        ],
        "source_width": 16,
        "source_height": 16,
        "name": "walk_000",
        "duration_ms": 111.11111111111111,
        "pivot": [
          8,
          15
        ]
      },
      {
        "index": 1,
        "x": 16,
        "y": 0,
        "width": 16,
        "height": 16,
        "trim": [
          0,
          0,
          16,
          16
        ],
        "source_width": 16,
        "source_height": 16,
        "name": "walk_001",
        "duration_ms": 111.11111111111111,
        "pivot": [
          8,
          15
        ]
      }
    ]
  }
}
Step-by-step workflow

How to import Celgrid pixel art into Unity 2D in four steps

Step 01

Install UnitySpriteForgeImporter.cs once in your Unity project

Copy UnitySpriteForgeImporter.cs.txt from any downloaded Celgrid pack.zip into Assets/Editor/SpriteForgeImporter.cs. Unity compiles the menu item Assets > SpriteForge > Import animation automatically.

Step 02

Extract your Celgrid sprite pack into Assets/Sprites/

Keep sprite.json alongside the frames/ folder inside a dedicated subfolder such as Assets/Sprites/FrontlineSoldier/.

Step 03

Select sprite.json and run the importer

Click sprite.json in the Unity Project window, open Assets > SpriteForge > Import animation, and Unity generates the configured Sprite assets plus the .anim clip with custom pivots and loop settings.

Step 04

Match Pixels Per Unit (PPU) to your tile grid

Use 16 PPU for 16x16 starter packs (Meadowkeep, Frontline 1944), 24 PPU for 24x24 packs (Cryptbound, Sunspire Tactics), or 32 PPU for Arcade Platformer 32x32 sprites with Unity's 2D Pixel Perfect Camera.

Unity 2D Pixel Perfect Math

Recommended Pixels Per Unit (PPU) for Celgrid sprite grids

Celgrid Native GridUnity PPUTile ScalePixel Perfect Camera Reference
16x16 (Meadowkeep, Frontline 1944)16 PPU1 world unit = 1 tile320x180 or 480x270 ref resolution
24x24 (Cryptbound, Sunspire Tactics)24 PPU1 world unit = 1 hero cell480x270 or 640x360 ref resolution
32x32 (Arcade Platformer preset)32 PPU1 world unit = 1 large tile640x360 ref resolution
Direct answers

Unity 2D Pixel Art FAQ

How does Celgrid convert pixel pivots from top-left to Unity bottom-left coordinates?

Celgrid stores pixel anchors from top-left origin [px, py] in sprite.json. The bundled UnitySpriteForgeImporter.cs converts them automatically to Unity normalized coordinates via new Vector2((float)px / width, 1f - (float)py / height).

Why do AI sprites usually look blurry or discolored in Unity?

Two reasons: diffusion generators output anti-aliased sub-pixels, and Unity defaults to Bilinear filtering with lossy texture compression. Celgrid fixes both by generating exact indexed RGBA grids and applying FilterMode.Point with Uncompressed textures during import.

Does the Unity importer work with URP 2D and Pixel Perfect Camera?

Yes. The importer creates standard Unity Sprite assets and SpriteRenderer m_Sprite AnimationClips compatible with Built-in 2D, URP 2D Renderer, 2D Lights (using optional diffuse/light maps), and the 2D Pixel Perfect package.

Can I adjust animation FPS after importing without regenerating pixels?

Yes. Change FPS (0.5 to 60) directly in Celgrid Studio or via POST /v1/pixel-assets/{id}/timing at 0 credits, or adjust the sample rate on the generated Unity .anim clip.

Ship crisp Unity 2D pixel art today

Start with 25 free starter credits (verified signup) plus 4 complete starter packs and zero-credit manual editing and exports.