A sprite atlas is two artifacts that have to agree: the bitmap sheet itself, and the metadata file that tells the engine where each frame sits. When the two drift apart, the symptoms look the same in Unity, Godot, and Phaser: sprites show the wrong region, a strip slides a few pixels sideways, frames clip at the edge, or the editor reports a region it cannot find. The usual reach-for fix is re-exporting the sheet from the source art project. That costs a rebuild, a round trip through the art tool, and it often leaves the broken metadata untouched. Most of these faults are metadata-only: the bitmap is fine, and a small offline edit to the JSON or XML file resolves them.
This walkthrough covers four fault patterns observed on real Unity, Godot, and Phaser exports. For each one, I show how to confirm the fault from the data itself, and the concrete field to change, before you touch the art source.
Before you edit anything, make a copy of the metadata file and leave the original bitmap untouched. Metadata patches are small and reversible, but a blind overwrite can erase frame names that your animations still reference. Open the sheet in an image viewer alongside the JSON or XML so you can cross-check a rectangle against the pixels it covers. Work one sheet at a time, and re-run the same check after each edit instead of batching several changes before comparing the result.
How atlas metadata is structured
A JSON sheet (Phaser, many Unity sprite-sheet exporters) stores a frames dictionary. Each entry carries x, y, w, h for the rectangle on the sheet, and a meta.size block with the sheet width and height. An XML sheet (Godot, older Unity workflows) stores one node per frame with a name attribute and an x, y, w, h rect, plus a reference back to the atlas bitmap. Every check below starts from those fields.
1. JSON frames missing keys
What you see. The engine warns that a frame is not found, or several sprites render blank even though the sheet image looks complete in an image viewer.
How to confirm. Open the JSON and walk every entry in frames. Each entry should expose numeric x, y, w, and h. A missing or non-numeric field means the engine cannot place that slice. Then check that every rectangle stays inside the dimensions in meta.size.
import json, pathlib def check_json_atlas(path): data = json.loads(path.read_text(encoding="utf-8")) size = data["meta"]["size"] sheet_w, sheet_h = size["w"], size["h"] problems = [] for name, frame in data["frames"].items(): for key in ("x", "y", "w", "h"): if key not in frame or not isinstance(frame[key], (int, float)): problems.append(f"{name}: missing or non-numeric {key}") x, y, w, h = (frame.get(k, 0) for k in ("x", "y", "w", "h")) if x + w > sheet_w or y + h > sheet_h: problems.append(f"{name}: rect outside sheet {sheet_w}x{sheet_h}") return problems How to fix. Fill a missing w or h from the source slice size. Do not invent an x or y by guessing; if the slice entry is absent entirely, rebuild it from the original slice rather than estimating the rectangle. Re-run the check after the edit so the out-of-bounds list comes back empty.
2. XML frame name and atlas index mismatch
What you see. In Godot, a sprite appears under the wrong name, or an animation swaps between two unrelated frames as it plays.
How to confirm. Parse the XML and list every frame name next to its rectangle. Look for duplicate names, and check that every name referenced by your animation keys actually exists in the list. A common copy-paste error is one rectangle duplicated across several names, which moves the wrong slice under each label.
How to fix. Rename the frame node's name attribute so it matches the animation key. Leave the rectangle unchanged unless the region itself is wrong. If two frames share one rectangle, restore the second rectangle from the slice map before renaming anything else, or you will still point both labels at the same pixels.
3. frameWidth written wrong, whole strip misaligned
What you see. Every frame after the first one shifts horizontally by a constant offset, and rows drift further apart the lower they sit. The first frame often looks correct, which makes this easy to miss.
How to confirm. Compare the frame width recorded in the metadata against the real slice width on the bitmap. Compute how many columns fit across meta.size.width, and verify each frame's x lands on column * frameWidth, with y on row * frameHeight.
def grid_mismatches(frames, frame_w, frame_h, sheet_w): bad = [] for name, f in frames.items(): col = round(f["x"] / frame_w) row = round(f["y"] / frame_h) expect_x, expect_y = col * frame_w, row * frame_h if f["x"] != expect_x or f["y"] != expect_y: bad.append((name, f["x"], f["y"], expect_x, expect_y)) columns = sheet_w // frame_w return bad, columns How to fix. Set frameWidth to the real slice width first, then re-derive each x as column * frameWidth and each y as row * frameHeight. If the sheet uses padding between slices, keep that padding in the stride; changing only the width without fixing the stride reproduces the same drift one pass later.
4. Atlas re-exported twice, meta.size no longer matches the bitmap
What you see. Frames near the bottom or right edge clip, and the engine reads coordinates against a sheet size that no longer matches the current bitmap.
How to confirm. Open the bitmap and read its real pixel width and height. Compare that to meta.size in the JSON, or to the sheet dimensions referenced in the XML. A difference here means the metadata still describes an older pack.
How to fix. Update meta.size to match the current bitmap dimensions. Leave the per-frame rects alone unless a frame now sits outside the new sheet. If the sheet grew, most frames need no coordinate change; if it shrank, remove frames that no longer fit rather than leaving clipped rects behind.
Why offline batch processing beats re-exporting
Re-exporting forces you to reopen the art project, confirm every slice, repack the sheet, and re-import it into the engine. Any change to slice padding or trimming shifts every coordinate in the file again. An offline checker reads the metadata and the bitmap side by side, flags the four faults above, and patches only the offending field. You keep the original bitmap, you do not touch the source art, and a whole folder of sheets can be checked in one pass before the next engine import.
Next step
The checks above map to a small offline helper that scans a folder of JSON and XML atlases and reports the same mismatches before import. A free sample is on the fixer page, and a matching breakdown for the Phaser JSON missing-frames case is in this error walkthrough. If you want the offline batch runner that applies these fixes across a whole folder, the full version is $19.

