/unity-dev:unity-2d-renderingfrom unity-dev
Diagnoses 2D sprite rendering issues in Unity: draw order, Y-sort, Light 2D, shadows, normal maps, sprite masks, and parallax. Provides symptom-to-cause mapping and diagnostic reports.
Ships in unity-dev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Moving a sprite in z is almost never the fix. Two overlapping renderers are compared on sorting layer, then Order in Layer, then render queue, then distance along the sort axis. The first key that differs decides and the rest are never read. World z is only what "distance" happens to mean under the default sort mode — and under a custom axis it means nothing.
The first
Light2Dyou add turns everything it does not light black. With no light in the scene, lit sprites draw at full colour; with one, every pixel outside its shape and every sorting layer it does not target receives darkness. Both halves are one question: which asset is the renderer actually reading?
First match wins. Stop at the first cause the audit or the frame confirms.
| Symptom | Go to |
|---|---|
| A sprite draws behind one it should be in front of | §1 |
| Changing z or Order in Layer makes no difference | §1 — an earlier key already decided |
| Two sprites flicker or swap as the camera moves | §1 — a tie on all four keys |
| A character's hat, weapon or carried item sorts apart from its body | §2 |
| Something appears between the parts of a character | §2 |
| Seen from above, the runner walks behind a shelf or wall it stands in front of | §3 |
| Isometric or hex pieces draw inside out against the board | §3 |
| The sort axis is set under Project Settings and nothing changed | §0, then §3 |
| The runner cannot walk behind a tall tile, or is always behind the whole Tilemap | §4 |
| Particles or a world canvas draw under the sprites | §4 |
| The Light 2D does nothing | §5 |
| Everything went black after adding one light | §5 — no Global light |
| One sorting layer stays dark, or stays bright, under a light | §5 — target sorting layers |
| No shadow, or a wall that shades itself black | §6 |
| The normal map does nothing | §6 |
| A sprite mask hides nothing, or hides sprites it should leave alone | §7 |
| Tinting or flashing one sprite multiplied the draw calls | §7 |
| A parallax background: layers shudder, slide after a respawn, or run out in a long level | §8 |
| A generated scene to scroll endlessly, or props repeating beside their own mirror image | §8 — reference/parallax-layers.md |
Work on a live Editor (unity-debug → reference/editor-control.md) and run two reports first:
Renderer2DSetup.Report() — the pipeline in force, its renderers, and the sort mode and axis
actually read (built-in: the camera and Project Settings; URP without a 2D Renderer: the camera's
axis and no lights; URP with one: only the renderer asset's) — and SortingAudit.Json() —
every renderer's four keys, group, sort point, lit material and the pairs that tie. Answer from
the Frame Debugger where it disagrees with the audit; change only the key that decided, and
restore anything changed while probing. In full: reference/before-diagnosing.md.
| # | Key | Set on | Decides |
|---|---|---|---|
| 1 | Sorting layer | Renderer; order from the list in Tags and Layers | Higher in the list draws first |
| 2 | Order in Layer | Renderer, −32768 to 32767 | Higher draws later, on top |
| 3 | Render queue | Material | Higher draws later. Both default sprite shaders are 3000 |
| 4 | Distance along the sort axis | The renderer's sort point and the sort mode | Further draws first |
layerValue, order,
queue, distance. The first difference is the whole explanation.ties array lists every overlapping pair. Fix a tie with a key, never with a hope that
hierarchy order holds.SortingLayer.id is not an order. Compare SortingLayer.GetLayerValueFromID(id). A
misspelt sortingLayerName lands on Default without an error.Default, Orthographic or Perspective. Under
CustomAxis with (0, 1, 0) z is ignored completely.MeshRenderer there ignores keys 1 and 2 against sprites and hides them by z.Each key in full, the three places a sort axis can live, and the fix per deciding key:
reference/sort-order.md.
A SortingGroup on a root makes everything below it sort as one unit against the outside,
using the group's own layer and order and the root's position. Inside, the children order
themselves with their own keys.
sortAtRoot on a nested group takes it out of its parent.What a group costs and what it isolates: reference/sort-order.md.
Depth in a top-down, isometric or hex view is key 4 with a custom axis. Four settings, and it fails if any one is missing:
CustomAxis, axis (0, 1, 0) — on the asset §0 named.unity-2d-sprites for setting pivots.SpriteRenderer.spriteSortPoint = SpriteSortPoint.Pivot. The default is Center, which
swaps a tall shelf and the runner half a shelf late.Isometric Z as Y starts from (0, 1, -0.26). A board with rows is often better served by an
Order in Layer per row than by the axis. Layer table, split tall objects, the isometric and hex
cases, and the row formula: reference/y-sort.md.
TilemapRenderer.mode. Chunk sorts the map as chunks: the runner is in front of all
of it or behind all of it. Individual sorts each tile at its own position against other
renderers on the same layer and order — required for tall tiles the runner walks behind,
and it gives up chunk batching. Keep floors on Chunk, put tall tiles on a second Tilemap.TilemapRenderer.sortOrder is the corner the renderer starts from among its own tiles.Canvas.sortingLayerID and sortingOrder.Values and checks: reference/sort-order.md.
Three conditions, all required. First failure wins.
renderer2DInForce in the §0 report.lit in the audit. Sprite-Unlit-Default and the
Built-in Sprites/Default never react.And the inversion: no Light2D at all means full colour; one Light2D means everything it
does not reach is black. Make the first light in a scene a Global light on every layer.
Light types and defaults, blend styles, the cost per light, and why lights that skip a layer
in the middle of the stack multiply the light textures:
reference/lights-2d.md.
Each needs a setting on the light and a piece on the sprite.
ShadowCaster2D; both target the layer the shadow falls on. CastShadow leaves the caster
itself lit; CastAndSelfShadow darkens it. A Tilemap casts through its composite collider._NormalMap — unity-2d-sprites
→ reference/data-provider.md — and the light's Normal Maps quality is Fast or
Accurate. The default is Disabled, and the property is read-only from script._MaskTex on the sprite plus a blend style that reads a mask channel.reference/shadows-and-normals.md.
SpriteMask reaches only renderers whose maskInteraction is not None — the default is
None. Narrow it with a custom range in sorting-layer and order units, or by placing it
inside a SortingGroup.SpriteRenderer.color: it is vertex colour and keeps the batch. A
MaterialPropertyBlock or renderer.material takes the renderer out of it.reference/masks-and-materials.md.
One factor per layer — 0 moves with the world, 1 is locked to the camera — applied
after the camera's final position for the frame. A layer placed before the camera trails
by a frame and shudders on every acceleration. resources/ParallaxLayer.cs runs after the
Cinemachine Brain, wraps endlessly for a runner, snaps to the pixel grid, and has Snap() for
cuts and respawns. Camera timing itself is unity-camera → reference/update-order-and-jitter.md.
A scene split into depth layers — comfyui-asset-generation (game-assets plugin) → scene_layers.py — becomes one rig
with ParallaxRigBuilder: ParallaxTiles mirrors continuous strips and shuffles props one per
tile with seeded gaps, so no prop stands beside its own copy; tile i always holds the same art.
reference/parallax.md; reference/parallax-layers.md.
| File | Does |
|---|---|
resources/Editor/SortingAudit.cs | Read-only. Every renderer's four keys, group, sort point, lit or unlit, tied pairs, as JSON: SortingAudit.Json() |
resources/Editor/Renderer2DSetup.cs | Report() the pipeline, renderers and sort axis. Creates a 2D Renderer or sets its axis after reporting the plan and waiting for confirmation |
resources/ParallaxLayer.cs | One parallax layer: factor, wrap, pixel snap, Snap() |
resources/ParallaxTiles.cs, TileSequence.cs | Endless tiles on a layer: Mirror, Repeat, Shuffle with gaps; deterministic per tile |
resources/Editor/ParallaxRigBuilder.cs | scene.json + PNGs (or a PSD, PsdLayerReader.cs) → rig prefab. BuildFromCommandLine |
Menu root: Tools → Unity Dev → 2D Rendering.
Pixel-art filtering, the pixel-perfect camera and tile seams are unity-2d-pixel-perfect.
Post-processing Volumes, bloom on lit sprites and renderer features are unity-render-urp; moving a Built-in project onto URP is unity-urp-migration. Sprite
pivots, slicing and secondary textures are unity-2d-sprites; packing is unity-sprite-atlas.
Tile palettes, their own sort setting and rule tiles are unity-tilemap; which Tilemap goes on
which sorting layer is unity-2d-level → reference/layer-stack.md. Skeletal sprite meshes
and bones are unity-2d-animation. Colliders, including the Tilemap collider a shadow caster
reads, are unity-physics-2d. Camera follow, confiners and shake are unity-camera. Draw
calls and frame time as numbers are unity-profiling.
reference/before-diagnosing.md (opens in a new tab)reference/lights-2d.md (opens in a new tab)reference/masks-and-materials.md (opens in a new tab)reference/parallax-layers.md (opens in a new tab)reference/parallax.md (opens in a new tab)reference/shadows-and-normals.md (opens in a new tab)reference/sort-order.md (opens in a new tab)reference/y-sort.md (opens in a new tab)resources/Editor/ParallaxRigBuilder.cs (opens in a new tab)resources/Editor/PsdLayerReader.cs (opens in a new tab)resources/Editor/Renderer2DSetup.cs (opens in a new tab)resources/Editor/SortingAudit.cs (opens in a new tab)resources/Editor/Tests/ParallaxRigBuilderTests.cs (opens in a new tab)resources/ParallaxLayer.cs (opens in a new tab)resources/ParallaxTiles.cs (opens in a new tab)resources/Tests/ParallaxTilesTests.cs (opens in a new tab)resources/TileSequence.cs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub tipoli5890/game-studio --plugin unity-dev51 skills in this plugin
/unity-2d-animationSkeletal 2D characters: PSB rig, bones and weights, sprite swaps, 2D IK (2D Animation package)./unity-2d-controllerMove a 2D character: platformer jump, slopes, coyote time, moving platforms, top-down movement./unity-2d-gridGrid tactics and tile puzzles, hex or square: move range, A* paths, line of sight, turns, undo./unity-2d-level2D level layout as data: Tiled/LDtk import, rooms, endless chunks, seeded levels, jump reachability.