How to sync pixel art with Unity, Godot and GameMaker
Exporting a sprite, copying it into the game and importing it again gets old by the tenth tweak. The MagicPixel command line tool links your game's project folder to your MagicPixel library instead: PNGs you change in the project upload to MagicPixel, and sprites you finish in MagicPixel go back to the same files when you press Sync. It works on the files in the folder, so any engine that loads PNGs from disk can use it: Unity, Godot, GameMaker or a web game.
Below are the setup, the rules sync follows, the import settings that keep pixel art sharp in each engine, and the full CLI and REST reference. Sync is in beta and needs a paid plan and Node.js 18 or newer. Want an AI agent to make the art too? See connecting an AI assistant.
Updated
Game → MagicPixel
MagicPixel → game
How two-way sync works
- Your game's sprites come in where they are. The first sync brings the project's PNGs into MagicPixel, under Synced in the Files tab, and remembers each file's path. Editing one writes back to that same file, not to a copy.
- Saving is not shipping. Saving keeps your work in MagicPixel. Nothing reaches the game until you press Sync on the artboard, and it reads Synced only once the game has downloaded that version.
- Conflicts are reported, never overwritten. If a sprite changed in both places, the CLI writes nothing and tells you, and you choose which copy wins for that one file.
- Renames and deletes clean up after themselves. Rename a sprite or folder in MagicPixel and the next sync moves the file instead of leaving an orphan, and removes the old file's Unity
.metatoo. - PNG in, PNG out. Sync moves PNG files of up to 16 MB each. An artboard with more than one painted layer, or with animation frames, is skipped until you choose to flatten it, so a layered document is never squashed by accident.
Sync needs a paid plan: Hobby includes 1 sync project, Indie 3 and Studio 10, and new files count toward your plan's storage. See pricing.
Set up sync for a game engine
Make a sync key
In MagicPixel, open Settings → Projects & API Keys and press the key icon (New API key) on the project that holds this game's art, then Copy key. A key starts with
mp_live_and sees only its own project.Link the game folder
In a terminal, in your game's project folder (the one with
project.godot,ProjectSettings/or the.yypfile), run:npx @magicpixelart/cli@latest startIt detects the engine, writes
magicpixel.json, asks for your key and runs the first sync. Answer yes when npx asks to install the package.Leave the watcher running
npx @magicpixelart/cli sync --watchEdits to your game's PNGs come back into MagicPixel within seconds.
Press Sync when a sprite is final
The Sync button sits in the artboard's top-right corner. It reads Queued until your game has downloaded the sprite, then Synced. The artboard's ⋮ menu and right-click menu have the same Sync to Game; select several artboards first to send them together.
| Engine | Detected by | New sprites go to |
|---|---|---|
| Godot | project.godot | assets/magicpixel |
| Unity | ProjectSettings/ProjectVersion.txt | Assets/MagicPixel |
| GameMaker | *.yyp | datafiles/magicpixel |
- Godot and Unity import changed PNGs on their own while
sync --watchruns. - GameMaker gets the files in Included Files but doesn't refresh them by itself: use Refresh Included Files after a sync.
- Always pass the full package name.
magicpixelis the command the package installs, so the shortmagicpixel syncworks only afternpm i -D @magicpixelart/cliin that project. In CI, usenpx -y. npx @magicpixelart/cli doctor --jsonreports the engine it found and youroutDir.
Which artboards reach the game
Only artboards you press Sync on are written to the game. A press releases that artboard and stops the file's other artboards from exporting, so a document can hold a hundred drafts and variants while only the finished sprite syncs, even in a synced folder. Synced a file before you narrowed it down? Run npx @magicpixelart/cli sync --full once: the full pass removes sprites your project no longer asks for, and their .meta files. The watcher's regular full pass does the same on its own.
New sprites mirror your library's folders: Props/Rocks/rock-a in MagicPixel becomes Assets/MagicPixel/Props/Rocks/rock-a.png in Unity. Rename a folder and the next sync moves the files instead of duplicating them.
When a sprite changed in both places
The CLI reports a conflict and writes nothing, so neither copy is lost. Press Sync on that artboard to keep MagicPixel's version, or run npx @magicpixelart/cli push --force to keep the file on disk. Your other files are untouched, and --force still checks the live cloud copy first, so a save that lands mid-push is reported rather than overwritten. push on its own uploads without pulling; try push --dry-run first to see the list.
Only some folders, or several games in one repo
- Every game PNG syncs by default.
npx @magicpixelart/cli connect 'Sprites/Hero/**'narrows it, andsync --watch --only Sprites/Enemieswatches one folder and leaves everything else alone. - A folder isn't syncing?
npx @magicpixelart/cli why Sprites/Enemiesexplains why and prints theconnectcommand that fixes it. To keep a folder out on purpose, add it toexcludeinmagicpixel.json. - Changed a lot of files locally, for example resized them? Run
npx @magicpixelart/cli resync 'Sprites/Enemies' --dry-runto preview, then again without--dry-run, or right-click the folder in the library and choose Resync from game…. Local files win, and files missing locally move to Trash (a file at a time: an artboard inside a file is never deleted). - Run sync inside the game folder you linked. Sprites from another game folder are skipped rather than copied in (add
--hereif you really want copies there), andclean-straysremoves copies an older version left behind. - Several game folders in one repo? Run
startin the folder that holds them all: it keeps one setup there, merges older per-folder setups (backed up first) and scans every game folder, hidden ones included.
Keep pixel art sharp in the engine
Pixel art turns blurry or uneven in a game for two reasons: the engine smooths the texture when it scales it up, or it scales by a fraction, so some pixels end up wider than others. Here is the head of our fox sprite, 32 × 32 pixels, enlarged three ways:
Point filter, 8×: sharp
Bilinear filter, 8×: blurred
Point filter, 7.5×: uneven pixels
Unity
For every PNG it adds, the CLI writes a .meta file with pixel art import settings: Sprite (single), Filter Mode Point, Compression None, mipmaps off, wrap Clamp and 32 Pixels Per Unit, with deterministic GUIDs so scene and prefab references never break. Set "unityPpu" in magicpixel.json for another Pixels Per Unit. Settings you change in Unity on an existing sprite stay as you set them.
Use one Pixels Per Unit for every sprite, then add a Pixel Perfect Camera: set its Assets Pixels Per Unit to the same number and its Reference Resolution to your game's pixel resolution, such as 320 × 180. Unity's guide to preparing sprites for the Pixel Perfect Camera walks through it.
Godot
Godot imports the PNGs itself and writes its own .import files. In Godot 4, set Project Settings → Rendering → Textures → Canvas Textures → Default Texture Filter to Nearest once, and every sprite draws with sharp pixels; a node's own Texture Filter can still override it. See default_texture_filter in Godot's project settings reference.
GameMaker
New sprites land in Included Files (datafiles/magicpixel), which your game loads at runtime, and the CLI creates no sprite resources. Turn off Interpolate colours between pixels in the Graphics section of each platform's Game Options, or call gpu_set_texfilter(false), so sprites stay sharp.
In any engine
- Scale by whole numbers: 2×, 3× or 4×. A 320 × 180 game fills a 1920 × 1080 screen at exactly 6×.
- Keep one pixel size for the whole game: make every sprite at the size the game shows it. The sprite generating guide covers picking it.
- Turn texture compression off for sprites. It shifts colours and smears edges.
Web projects: one prompt (Vite)
For a web game built with Vite, an AI coding tool can do the whole setup. You need a few sprites saved in your library and the project open in your AI tool.
Preview only: the key is a placeholder. Copy the real prompt from your key in step 2.
Set up MagicPixel asset sync. The Vite plugin pulls my saved sprites into the project as PNGs and keeps them updated automatically while `vite dev` runs — dev-time only, never called from app runtime.
Verify on npm first (if either fails to resolve, stop and tell me — don't substitute look-alike packages):
- https://www.npmjs.com/package/@magicpixelart/vite
- https://www.npmjs.com/package/@magicpixelart/cli
- Docs: https://magicpixel.art/guides/sync
Then do these in order and report back:
1. Save the value below as a secret named MAGICPIXEL_API_KEY (use the project's secret manager — do not commit it or write it to .env):
mp_live_paste_your_key_here
2. Install @magicpixelart/vite as a dev dependency (it pulls in @magicpixelart/cli).
3. Add the plugin to vite.config.ts:
import { magicpixel } from '@magicpixelart/vite';
export default defineConfig({ plugins: [/* existing */, magicpixel()] });
4. Run `npx @magicpixelart/cli start` with MAGICPIXEL_API_KEY in the environment. This authenticates, creates magicpixel.json, and syncs sprites into src/assets/magicpixel/.
5. Add `.magicpixel/` to .gitignore, then restart `vite dev`. Future saves in MagicPixel hot-reload in ~2 seconds.
6. Tell me how many sprites synced and the top-level folders they landed in.
Note: the key above ("mp_live_paste_your_key_here") is a placeholder. Ask me for my real key (starts with mp_live_) from https://magicpixel.art/settings → API Keys before running anything.Organize your sprites
Group sprites into folders: the folder and sprite name become the file path your code uses.
player/ hero-idle.png hero-run.png enemies/ slime.png ui/ heart.pngWorking on more than one game? Press New project in Settings → Projects & API Keys and give each game its own project and key.
Make a sync key
Settings → Projects & API Keys, the key icon on your project, then Copy setup prompt. Closed the panel before copying? Revoke that key and make a new one.
Paste the prompt into your AI tool
Paste it into your AI coding tool, such as Lovable, Bolt, Cursor or Replit. It saves the key as a secret, installs the plugin and runs the first sync. Sprites land in
src/assets/magicpixel/.
After that, render sprites from src/assets/magicpixel/<folder>/<name>.png, or import the typed MagicPixelAssets map from @/assets/magicpixel (MagicPixelAssetsById survives renames). A sprite you Sync arrives in about 2 seconds while the dev server runs.
Web projects: manual setup
Option A: the Vite plugin
npm i -D @magicpixelart/viteThe plugin bundles @magicpixelart/cli. Add it to your Vite config:
// vite.config.ts
import { defineConfig } from 'vite';
import { magicpixel } from '@magicpixelart/vite';
export default defineConfig({
plugins: [/* your existing plugins */, magicpixel()],
});Then link the project once:
npx @magicpixelart/cli startstart detects your framework, writes magicpixel.json, asks for your key, runs the first sync and offers a magicpixel:watch npm script. The plugin then runs the watcher with your dev server, so every artboard you Sync arrives within about 2 seconds and hot-reloads.
Option B: the CLI alone (other bundlers, CI)
npm i -D @magicpixelart/cli
npx @magicpixelart/cli start # link the project and run the first sync
npx @magicpixelart/cli sync --watch # keep sprites fresh while you workstart stores your key in .magicpixel/credentials (mode 0600, kept out of git). In CI, set MAGICPIXEL_API_KEY instead; it takes precedence over the credentials file.
magicpixel.json
It lives in the project folder. Edit it by hand or with magicpixel add <glob> and magicpixel remove <glob>.
{
"outDir": "src/assets/magicpixel",
"include": ["player/**", "ui/icons/*"],
"exclude": ["**/wip-*"],
"emitIndex": true
}init picks the outDir for your kind of project:
| Project | Default outDir | Notes |
|---|---|---|
| Vite, Remix, TanStack Start | src/assets/magicpixel | — |
| Next.js, Astro, Nuxt, CRA | public/magicpixel | — |
| SvelteKit | static/magicpixel | — |
| Godot | assets/magicpixel | res://assets/magicpixel/… |
| Unity | Assets/MagicPixel | Unity imports it under Assets/ |
| GameMaker | datafiles/magicpixel | Included Files: refresh after a sync |
| Anything else | assets/magicpixel | src/assets/magicpixel if src/ exists |
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| outDir | string | No | by project | Where PNGs (and index.ts when emitIndex is on) are written. |
| include | string[] | No | ["**/*"] | Globs matched against "folder/slug". |
| exclude | string[] | No | [] | Globs to skip both ways: never downloaded, and matching game PNGs are never uploaded (wins over connect). To hide a folder, add e.g. "Sprites/Old/**", then delete it in the library; the files stay in your game. |
| connect | string[] | No | ["**"] in game engines | Game PNG globs that sync. Default is every sprite; narrow it with magicpixel connect. |
| syncOnly | string[] | No | — | Default for sync --only: the game folders a plain sync is limited to. |
| unityPpu | number | No | 32 | Pixels Per Unit written into new Unity .meta files. |
| emitIndex | boolean | No | true (JS only) | Write <outDir>/index.ts with a typed asset map. Off for Unity, Godot and GameMaker. |
| endpoint | string | No | production | Override the API base (HTTPS only). For testing. |
.magicpixel/state.json remembers the last sync. Keep .magicpixel/ out of git; init offers to add it to .gitignore.
CLI commands
| Command | What it does |
|---|---|
| start [--force] | Link the project: init, login and the first two-way sync. Works for Unity, Godot, GameMaker and JavaScript projects. |
| init [-y] [--force] | Config wizard. Detects Vite, Next, Unity, Godot or GameMaker and suggests outDir. |
| login [--key <key>] | Save your key to .magicpixel/credentials, after checking it with the server. |
| logout | Remove the stored key. |
| sync [...flags] | Two-way: pull MagicPixel edits and push changed game sprites. Use --watch while you work. |
| push [--dry-run] [--flatten] [--force] | Upload only. --force keeps your local copy when both sides changed. |
| resync <folder> [--dry-run] [-y] | Local files win for one folder: overwrite MagicPixel copies, move files missing locally to Trash. |
| connect <glob> | Limit which game folders sync (default: every sprite). |
| why <path> | Explain why files in a folder aren't uploading, and print the connect command that fixes it. |
| clean-strays [--dry-run] [-y] | Remove copies sync wrote into the wrong game folder. Your own game files are never touched. |
| consolidate [--dry-run] | Merge per-folder setups in one repo into a single setup (backed up first). |
| search <query> | Search the indexed game PNGs, offline. |
| add <glob> / remove <glob> | Manage include patterns for MagicPixel → disk. |
| list | Print the matching sprites as a table. |
| status | Config, last sync and differences from MagicPixel. |
| whoami | Check the key and report how many sprites it sees. |
| doctor [--json] [--offline] | One-screen diagnosis. Paste it to your AI agent when something breaks. |
| repair [--dry-run] [-y] | Self-heal: check the key, set aside state.json, prune empty folders, run a full sync. |
sync flags
| Flag | Meaning |
|---|---|
| -w, --watch [seconds] | Poll for changes: every 2 s, slowing to 5 s after a minute idle, 10 s after 5 minutes and 30 s after 15, and back to 2 s on the first change. |
| --no-prune | Keep local files that are no longer in MagicPixel (full syncs prune them by default). |
| --dry-run | Print the plan and write nothing. |
| --full | Ignore the last sync time and fetch everything again. |
| -c, --concurrency <n> | Parallel downloads, 1 to 16 (default 6). |
| -q, --quiet | Minimal output, for CI. |
| --only <folder...> | Push, pull and prune only inside these game folders (repeatable). |
Each sync prints what changed (+ added, ~ modified, ↪ renamed, - pruned). sync --watch exits with code 2 after 5 auth failures in a row, so a process supervisor can spot a revoked key.
REST API
The CLI is built on a small REST API: reads for pulling sprites down, and a write-back endpoint for pushing disk edits home. Use it directly where Node can't run, such as an engine plugin or a script in another language.
Authentication
Every request needs a key in the Authorization header. A key is bound to one project and sees only that project's sprites; revoke it any time in Settings.
Authorization: Bearer mp_live_abc123...Base URL
https://sddsilidjhvtvejzvolx.supabase.co/functions/v1List sprites (manifest)
/integration-assets/manifestLists the sprites your key can see, for diffing against disk before downloading only what changed.
Query parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| include | string[] | No | — | Globs matched against "folder/slug". Repeatable. Default: everything. |
| exclude | string[] | No | — | Globs to leave out. Repeatable. |
| since | ISO8601 | No | — | Only sprites updated after this time. |
| cursor | string | No | — | Pagination cursor from the previous response. |
| limit | number | No | 500 | Items per page, 1 to 1000. |
Response (200 OK)
{
"items": [
{
"id": "e5f6a7b8-...",
"key": "props/crate",
"name": "Crate",
"folder": "props",
"slug": "crate",
"width": 64,
"height": 64,
"sha256": "a1b2c3...",
"size_bytes": 482,
"updated_at": "2026-01-15T12:00:00Z",
"download_url": "https://sddsilidjhvtvejzvolx.supabase.co/functions/v1/integration-assets?key=props%2Fcrate"
}
],
"nextCursor": "MjAyNS0w...",
"count": 1
}While nextCursor isn't null, pass it back as ?cursor= for the next page. Compare sha256 with the file on disk to decide whether to download it again.
Download a sprite
/integration-assets?key=folder/slugReturns the sprite as a PNG. Address it by its stable key (recommended) or by assetId.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| key | string | No | — | Stable key: "folder/slug" or just "slug". Recommended. |
| assetId | uuid | No | — | The sprite's id. Either key or assetId is required. |
# By key (recommended):
curl -o crate.png \
-H "Authorization: Bearer mp_live_abc123..." \
"https://sddsilidjhvtvejzvolx.supabase.co/functions/v1/integration-assets?key=props/crate"
# Or by id:
curl -o sprite.png \
-H "Authorization: Bearer mp_live_abc123..." \
"https://sddsilidjhvtvejzvolx.supabase.co/functions/v1/integration-assets?assetId=e5f6a7b8-..."Every PNG response carries an ETag equal to its sha256. Send it back as If-None-Match to get 304 Not Modified when nothing changed; the CLI does this on every poll, so an idle watch downloads nothing.
Write sprites back (beta)
https://magicpixel.art/api/public/integration/ingestPushes PNGs edited on disk back into MagicPixel: up to 20 sprites a request (16 MB of PNG data in all, 4096 px a side). Each sprite either updates a known artboard (assetId + layerIdx) or adds a new file to the library by its disk path (path). Sprites for the same document are written together.
Body parameters (per sprite)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| key | string | Yes | — | Your identifier, echoed back in the matching result. |
| pngBase64 | string | Yes | — | The PNG on disk, base64-encoded. |
| diskSha256 | string | Yes | — | sha256 of that PNG; identical bytes come back as unchanged. |
| assetId | uuid | No | — | Document to write into. With layerIdx, this is an update. |
| layerIdx | number | No | — | Artboard index inside that document (required with assetId). |
| baseSha256 | string | No | — | sha the file was last synced from. Required for updates; a mismatch is refused as cloud-changed. |
| baseVersion | number | No | — | Manifest version the file was last synced from. While it still matches, the update is accepted even if the sha differs. |
| path | string[] | No | — | Slug path for a new file, e.g. ["props","rocks","rock-a"]. Folders are created as needed. |
| pathNames | string[] | No | — | Display names matching path, so the folder names keep their case. |
| flatten | boolean | No | false | Allow replacing an artboard with several painted layers or frames by one flat PNG. |
Response (200 OK)
{
"results": [
{ "key": "props/rock-a", "status": "updated", "assetId": "e5f6...", "layerIdx": 1, "sha256": "a1b2..." },
{ "key": "props/rock-b", "status": "unchanged", "assetId": "e5f6...", "layerIdx": 2, "sha256": "c3d4..." },
{ "key": "props/rock-c", "status": "conflict", "reason": "cloud-changed", "assetId": "e5f6...", "layerIdx": 3, "sha256": "9f8e..." }
]
}Each sprite's status is updated, created, unchanged, conflict or error, and the request itself still returns 200, so read every result. Conflict reasons: cloud-changed (someone saved in the editor; the result carries the live sha256, which you can send back as baseSha256 to keep your copy), would-flatten (pass flatten to accept it), legacy-document and not-found. A conflict never writes: the document in MagicPixel stays exactly as it was. npx @magicpixelart/cli push does all of this for you.
Errors
Errors come back as { "error": "Human-readable message" }, and every response has an X-Request-Id header: include it when you contact support.
| Status | Meaning |
|---|---|
| 304 | Not Modified: the ETag matched (downloads only). |
| 400 | Invalid or missing parameters. |
| 401 | Missing or invalid key. |
| 403 | The key is valid but cannot see this sprite. |
| 404 | No such sprite in this project. |
| 405 | Method not allowed. |
| 429 | Rate limit or daily download cap reached. Retry later; the CLI backs off by itself. |
| 5xx | Server error. The CLI retries with backoff and reports the request id. |
Troubleshooting
Most problems show up in one command: npx @magicpixelart/cli doctor (--json for a report you can paste, --offline behind strict proxies). For a clean start, preview npx @magicpixelart/cli repair --dry-run, then run it without the flag.
- Sprites look blurry or uneven in the game
- The engine is smoothing them or scaling by a fraction. Use point (nearest) filtering and whole-number scales; see the settings for each engine.
- My AI tool says the key is invalid
- The key probably wasn't saved as a secret. Ask it to confirm
MAGICPIXEL_API_KEYis set, then rundoctor. - Nothing was downloaded
- No sprite has been Synced yet, or the key belongs to a project with none. Press Sync on an artboard, or run
npx @magicpixelart/cli whoamito see what the key sees. - I renamed or deleted a sprite and the old file is still there
- A full sync prunes it: run
sync --full. If things still look wrong,repairsets the local state aside and syncs everything again. - Sync worked, then started failing
- Most likely the key's daily download cap, which resets at midnight UTC. Short-lived 429 and 5xx errors recover by themselves.
- index.ts doesn't show a rename
- Run
sync --fullonce. For sprites you don't want to chase, useMagicPixelAssetsById, which survives every rename. - Files download again on every sync
- Something in your build rewrites the PNGs, so their sha256 no longer matches. Sync into a folder your bundler reads but no image optimizer touches.
Questions
- Does MagicPixel sync with Unity, Godot and GameMaker?
- Yes. The MagicPixel command line tool links your game's project folder to your MagicPixel library and syncs its PNG files both ways, so it works with Unity, Godot, GameMaker and any other engine that loads PNGs from the project folder. It needs a paid plan and Node.js 18 or newer.
- Does saving in MagicPixel change my game files?
- No. Saving keeps your work in MagicPixel. A sprite reaches your game only when you press Sync on its artboard, and the button reads Synced once the game has downloaded that version.
- What happens if a sprite changed in MagicPixel and in my game?
- The command line tool reports a conflict and writes nothing, so neither copy is lost. Press Sync on the artboard to keep MagicPixel's version, or run push --force to keep the file on disk.
- How do I stop pixel art looking blurry in Unity?
- Give every sprite Filter Mode Point and Compression None, use one Pixels Per Unit for all of them, and add a Pixel Perfect Camera set to that Pixels Per Unit. For each new sprite, MagicPixel's command line tool writes a .meta file with Point filtering, no compression and 32 Pixels Per Unit.
- How do I keep pixel art sharp in Godot?
- In Godot 4, set Project Settings, Rendering, Textures, Canvas Textures, Default Texture Filter to Nearest, and scale the game by whole numbers such as 2x, 3x or 4x.
- Can I sync only some folders?
- Yes. Every game PNG syncs by default. The connect command narrows it to the folders you name, and sync --watch --only with a folder watches that folder and leaves the rest alone.
Telemetry
Unexpected CLI failures (server errors, uncaught exceptions) are reported so we can fix them before you have to tell us: the error message and stack, the command, the CLI, Node and OS versions, and the failed request's id. Never file paths, sprite names, configuration, environment variables or your key.
Turn it off with MAGICPIXEL_TELEMETRY=0. Nothing is sent when no key is set, or when endpoint in magicpixel.json points somewhere other than MagicPixel.
