TexturePacker to Unity — JSON Atlas to Sprites and Clips
Unity's Sprite Editor can slice a sheet on a grid, but a packed atlas has frames of different sizes at arbitrary places, so the rects must come from the data file. Drop the TexturePacker PNG and JSON here and export for Unity 6: the bundle carries every rect and pivot already converted to Unity's conventions, plus an editor script that applies them and builds one AnimationClip per animation.
A TexturePacker JSON gives every sprite's rectangle measured from the top-left of the PNG, its trim and an optional pivot from 0 to 1; Unity wants sprite rects measured from the bottom-left and a pivot relative to each rect. Drop the PNG and JSON into Nerulio and export for Unity 6: the bundle holds the converted rects and pivots in a .unity.json plus NerulioSpriteImporter.cs, an editor script that slices the texture (Sprite, Multiple, Point, uncompressed) and builds one AnimationClip per animation. Unity 6000.5.3f1 ran it in batch mode.

- Unity 6Verified· Unity 6000.5.3f1
- Godot 4Verified· Godot 4.7.2
- Phaser 3 / 4Verified· Phaser 3.90 + 4.2
- PixiJS 8Verified· PixiJS 8.21
- Aseprite JSONVerified· Phaser load.aseprite · PixiJS 8.21
- .asepriteVerified· Aseprite 1.3.18
- Spine / libGDXVerified· spine-canvas 4.2
- Starling / Sparrow XMLVerified· Phaser 4.2
- LÖVEVerified· LÖVE 11.5
- DefoldBuilt· Defold bob.jar 1.13.1
- GameMakerUNVERIFIED
- CSS spritesVerified· Chromium
- GIF / APNGDecoded· Pillow
Top-left rectangles, bottom-left sprites
Unity keeps several sprites on one texture as a texture with Sprite Mode Multiple and a list of sprite rectangles. Each rect is measured in pixels from the bottom-left corner, and each sprite's pivot is a point from 0 to 1 inside its own rect.
TexturePacker's y axis runs down from the top, so a frame at y with height h becomes rect y = page height − (y + h). A trimmed frame's rect holds only its stored pixels, so a pivot defined on the full frame must move into that rect: pivot x = (pivot px − trim x) ÷ w, and pivot y = (h − (pivot py − trim y)) ÷ h. A value outside 0–1 is correct; it means the pivot lies in the trimmed-away border.
Pixels Per Unit decides how large a sprite is in world units: 100 by default, and the script applies the value written in the JSON. Animation in Unity is an AnimationClip that swaps the SpriteRenderer's sprite at key times; the script writes one key at each frame's own start time.
- Sprite Mode Multiple
- One texture holding many named sprite rects.
- Sprite rect
- Rectangle, pivot and name of one sprite on the texture, in pixels from the bottom-left.
- Pixels Per Unit
- Texture pixels per world unit.
- AnimationClip
- Keyframes that change the SpriteRenderer's sprite over time.
Example: converting one trimmed frame
frame run_0 on the packed 38 × 50 page: x 0, y 34, w 18, h 15
trim at (10, 10) in a 40 × 29 frame; pivot bottom centre = (20, 29) px on the full frame
Unity rect y = 50 − (34 + 15) = 1 rect = (0, 1, 18, 15)
pivot x = (20 − 10) / 18 = 0.5556
pivot y = (15 − (29 − 10)) / 15 = −0.2667 below the rect: the feet are in trimmed-away rows
clip "run": sprite keys at 0.0, 0.1, 0.2, 0.3, 0.4, 0.5 s, loop on, 0.6 s per cycleAll six frames get pivots that point at the same spot of the original 40 × 29 frame, so the character does not jitter although each rect has a different trim.
TexturePacker publish settings and the Unity result
| Setting in TexturePacker | What the JSON then contains | In Unity 6 after the importer script |
|---|---|---|
| Data format JSON (Hash) or JSON (Array) | frames by name, or a list with filename | Sprite names = frame names without extension |
| Trim mode Trim | spriteSourceSize, sourceSize | Rect = stored pixels; pivot normalised inside it, so every frame keeps one anchor |
| Allow rotation on | rotated: true | The Unity target refuses a rotated pack: repack with rotation off |
| Pivot points | pivot from 0 to 1 on the full sprite | Custom pivot of each sprite, converted into the trimmed rect |
| Max size, multipack | meta.size; one JSON + PNG pair per page | The script raises the texture's Max Size to the next power of two that fits the page |
| (no setting) | No timing | Clips start at 100 ms per frame until you set durations in the Studio |
What it does
- Rects converted to Unity's bottom-left origin (y = page height − y − h), one SpriteRect per frame, named after the frame.
- Pivots normalised inside each trimmed rect from the pivot on the full frame, so trimmed frames stay aligned; a value outside 0–1 is intended.
- Texture settings for pixel art: Sprite, Multiple, Point filter, Uncompressed, no mipmaps, Max Size raised until the page fits.
- Pixels Per Unit is a number in the JSON, 100 by default, and the script applies it; edit it before importing if your game uses another scale.
- One AnimationClip per animation: SpriteRenderer sprite keys at each frame's own start time, looping as tagged.
How to do it
- Drop the atlas PNG together with its JSON.
- Check the animations grouped from the frame names, then set pivots and durations on the Timeline.
- Open Pack & Export, choose Unity 6 and export.
- Copy the folder into Assets/ with its Editor folder; Unity compiles NerulioSpriteImporter.cs.
- Run Tools › Nerulio › Import Studio JSON and pick the .unity.json; the sprites appear on the texture and the .anim clips next to the JSON.
Files you get
| File | What it is for |
|---|---|
run.png | The page texture (Nerulio's new packing, no rotation). |
run.unity.json | Pixels Per Unit, textures, sprites (rect, pivot, border) and clips with key times and loop. |
Editor/NerulioSpriteImporter.cs | Editor script: Tools › Nerulio › Import Studio JSON applies the texture settings and sprite rects, then writes the .anim clips. |
README-UNITY.md | The steps for this bundle. |
Import it into Unity 6
- Copy the folder into
Assets/, keepingEditor/inside it so that Unity compilesNerulioSpriteImporter.csas an editor script. - Make sure the 2D Sprite package (com.unity.2d.sprite) is installed; the 2D templates include it.
- Run Tools › Nerulio › Import Studio JSON and pick
run.unity.json: the sprites appear on the texture and the.animclips next to the JSON. - Add the clips to an Animator Controller on your character's SpriteRenderer object; each clip animates its sprite.
- If your game uses another scale, change
pixelsPerUnitin the.unity.jsonbefore running the import.
Check the result
- Open the texture in the Sprite Editor: six rects named run_0 … run_5, each pivot at the feet (below the rect for trimmed frames).
- Play the
runclip: 0.6 s per cycle, and the character does not move up or down between frames. - Texture inspector: Sprite Mode Multiple, Filter Mode Point, no compression, no mipmaps.
From TexturePacker JSON to Unity sprite settings
| JSON field | What the Unity importer sets | Why |
|---|---|---|
| frame {x, y, w, h} | SpriteRect with y = page height − (y + h) | Unity textures start at the bottom left |
| spriteSourceSize, sourceSize | pivot normalised inside the trimmed rect | every frame keeps one anchor point |
| pivot, or the one set with P | Custom alignment with that pivot | the character stands where it should |
| frame name | sprite name; animation from the name prefix | clips find their sprites by name |
| meta.size | Max Size raised to the next power of two that fits | Unity would otherwise shrink a large page |
| not in the JSON | Point, Uncompressed, no mipmaps, PPU 100 | crisp pixels; PPU editable in the JSON |
Troubleshooting
| Symptom | Likely cause | How to check | Fix |
|---|---|---|---|
| Sprites cut in the wrong places, shifted vertically | Rects typed in from the JSON without flipping y | Compare a rect's y with page height − (y + h) | Use the importer script, which converts y |
| The character jumps between frames | Pivots left at Center for trimmed rects | Sprite Editor: the pivot of each sprite | Import with the script; pivots are normalised inside each trimmed rect |
| The menu Tools › Nerulio is missing | The script is not in an Editor folder, or compile errors elsewhere block it | The Console for compile errors | Keep Editor/NerulioSpriteImporter.cs in an Editor folder and install com.unity.2d.sprite |
| Sprites look blurry or blocky-compressed | Texture settings changed after the import (Bilinear, compression) | The texture inspector | Point filter, no compression; see blurry pixel art in Unity |
| Hit boxes are missing | A Unity sprite has no field for them, so this importer does not carry them | The export notes say so | Export Generic JSON for the boxes and create colliders yourself |
Other ways to do it
| Option | When it is the better choice |
|---|---|
| TexturePacker's own Unity importer | You publish from TexturePacker for Unity regularly. It is distributed through the Unity Asset Store and was not measured here. |
| The Sprite Editor's grid slicing | The sheet is an even grid; for a packed atlas the rects must come from the data file. See sprite sheets in Unity. |
| Start from the source | With the .aseprite file, Aseprite to Unity keeps tags and durations that a TexturePacker JSON never had. |
Engine exports and how each was checked
"Verified" means the exported files were loaded by the real engine or tool on real CC0 assets and the result was compared with the source. Anything that was not loaded is labelled as such.
| Target | Files | Check |
|---|---|---|
| Godot 4 | .tres SpriteFrames · .tscn AnimatedSprite2D · .png.import | Verified Godot 4.7.2Loaded by Godot; every animation frame drawn and compared with the source file. The scene uses Nearest filtering; rotation is never used. |
| Unity 6 | .unity.json · Editor/NerulioSpriteImporter.cs · AnimationClip | Verified Unity 6000.5.3f1Batch mode: sprite rects, pivots, pixels, clip keys and durations checked. |
| Phaser 3 / 4 | atlas JSON (multiatlas) · .anims.json | Verified Phaser 3.90 + 4.2Frames and animations drawn by both versions. |
| PixiJS 8 | spritesheet JSON · animations · anchor · meta.scale | Verified PixiJS 8.21Rotated and multi-page atlases included. |
| Aseprite JSON | hash / array · frameTags · slices | Verified Phaser load.aseprite · PixiJS 8.21Tags keep their direction and repeat count. |
| .aseprite | layers · tags · durations · slices | Verified Aseprite 1.3.18Opened and rendered by the Aseprite command line. |
| Spine / libGDX | .atlas | Verified spine-canvas 4.2Every region drawn by the Spine runtime, rotated and trimmed; libGDX itself was not run. |
| Starling / Sparrow XML | XML per page | Verified Phaser 4.2Phaser 3.90 draws trimmed XML frames wrongly (its own bug); the "Sparrow XML (Phaser 3)" preset turns trim off and passes in 3.90 and 4.2. |
| LÖVE | Lua quads · nerulio_atlas.lua · main.lua | Verified LÖVE 11.5Every frame drawn and every animation stepped through the shipped helper. |
| Defold | .atlas · .tilesource | Built Defold bob.jar 1.13.1Built by Defold's command-line builder; the built texture's UVs were read back. |
| GameMaker | spr_<name>_stripN.png · gamemaker.json | UNVERIFIEDNot loaded in GameMaker (no headless GameMaker). The strips are cut the way its strip importer cuts them. |
| CSS sprites | .css · preview .html | Verified ChromiumEvery class drawn from the shipped stylesheet. |
| GIF / APNG | one file per animation | Decoded PillowEvery frame and delay decoded again after export; APNG is exact. |
Evidence
GIF decoder: 408 of 408 frames identical to Pillow on 29 real GIFs; APNG 132 of 132 on 16 files. .aseprite: 231 corpus files imported, re-written and reopened in Aseprite 1.3.18 with the same tags, durations and pixels (231/231). Exports: 49 runs in the real engines on real CC0 assets, 47 pass — the 2 failures are Phaser 3.90's trimmed-XML bug, which the Phaser 3 preset avoids.
Limits
- Rotated sprites in the JSON are imported still turned; the Unity target refuses a rotated pack.
- Frame timing is not in TexturePacker's JSON: set durations before exporting.
- Collision polygons and hit boxes are not written as Unity physics shapes.
- A grid or island guess is a preview with a confidence; nothing is cut until you press Apply, and every choice has one-click alternatives.
- .aseprite files whose layers do not compose exactly (e.g. group opacity) are imported flattened, and the Import panel says why.
- Rotated frames in an imported atlas stay rotated; their export is UNVERIFIED.
- Images up to 32,768 px per side (268 million pixels), subject to your browser's memory.
Versions and sources
Unity 6000.5.3f1 in batch mode ran NerulioSpriteImporter.cs on exported bundles and read back rects, pivots (one common anchor), pixels, clip keys and durations. The TexturePacker import is src/studio/sprite/atlas-data.js; TexturePacker's own Unity importer was not tested. Unity terms follow the Unity 6 manual.
Official documentation used
Questions
Do I need a TexturePacker importer in Unity?
No. The bundle brings its own editor script and needs only the 2D Sprite package (com.unity.2d.sprite) that the 2D templates include. Unity 6000.5.3f1 in batch mode ran it and read back rects, pivots, pixels, clip keys and durations.
Do my hitboxes reach Unity?
Not through this importer: a Unity sprite has no field for them. Boxes and collision polygons go into the Generic JSON export instead, and the Unity export tells you so.
My JSON has rotated frames. Can I still use it?
They import still turned and exporting them is UNVERIFIED; the Unity target itself refuses a rotated pack. Pack again in TexturePacker with rotation disabled and drop the new pair of files.
Is it free, and do I need an account?
Everything on these pages is free and works without an account. There is no watermark and no export that is held back.
Are my sprites uploaded?
No. The Studio decodes, packs and exports in this browser tab. Projects are autosaved in the browser (IndexedDB) and can be saved as a .nerulio file.
Does it need Aseprite or an engine plugin installed?
No. .aseprite files are read and written in the browser, and each engine bundle carries what that engine needs (for Godot, the import settings and scene; for Unity and the Godot TileSet, a small editor script).