/unity-dev:unity-scene-optimisationfrom unity-dev
Guides Unity developers through scene optimisation by matching symptoms to specific techniques: batching, LOD, occlusion culling, culling distances, and texture/fill management.
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.
Every lever here moves one counter and leaves the others alone. The SRP Batcher lowers SetPass calls and not draw calls. A
LODGrouplowers triangles and does nothing for a frame that is waiting on fill. Baked occlusion culling returns nothing in an open lane. A change made from habit lands on a counter that was never the problem. Each rung below starts from a numberunity-profilingreports and ends with the same number read again.
Read the row off a window you already have. First match wins.
| The window says | Go to |
|---|---|
| "Draw calls are too high, what do I change"; the SRP Batcher is not batching; GPU instancing does nothing | §1 — batching |
| Draw calls rose after a tint, a flash or a per-object colour was added | §1 — a property block left the batch |
| "Set up LODs for this prop"; triangles high looking down the lane, lower looking at the floor | §2 — LOD |
| Low-tier trees or props missing after an FBX import; a fixed camera never switches level | §2 — reference/lod.md, the importer's LODGroup |
| Triangles high at every distance | unity-3d-models → reference/import-and-decimate.md |
| It still draws the room behind the wall; occlusion culling does nothing | §3 — occlusion |
| Draw calls climb with view distance, and what is added is a few pixels tall; small props pop in | reference/distance-texture-fill.md §4 — culling distances |
| A second camera doubled every render counter | reference/distance-texture-fill.md §4 — the culling mask |
| Texture memory over budget, or textures soft after streaming was turned on | reference/distance-texture-fill.md §5 |
| "Is it overdraw?" GPU frame time far above the CPU times; frame time follows the resolution | reference/distance-texture-fill.md §6 — fill |
| A 2D scene with more draw calls than sprites on screen warrant | reference/distance-texture-fill.md §6 — sort order and atlases |
| Shadow caster count high | unity-lighting → reference/shadows.md |
| Allocation per frame, a spike on spawn, discarded work | unity-profiling → reference/where-the-time-goes.md |
unity-profiling → reference/compare.md.unity-profiling → reference/counters.md. Under -batchmode -nographics every render
counter is zero: this skill needs a window from an instrument with a graphics device.resources/Editor/SceneCostAudit.cs prints one JSON object for
the open scene and changes nothing: Tools/Unity Dev/Scene Optimisation/Audit Open Scene, or
SceneCostAudit.Audit() from an eval. It says where a counter comes from.python3 scripts/compare_windows.py base.jsonl cand.jsonl --label approach-gate \
--counters "Render/*,Memory/Texture Memory,Memory/Mesh Memory"
That script is unity-profiling → scripts/compare_windows.py. Read the whole table: a lever
that lowers its own counter and raises another has moved the cost, not removed it.
Cheapest test: turn the SRP Batcher off on the URP Asset for one window. SetPass calls jumping says it was carrying the scene and the remaining cost is elsewhere; no change says the scene's renderers are not on it.
A draw takes the first path that accepts it:
| Path | Lowers | Needs | Frame Debugger event |
|---|---|---|---|
| GPU Resident Drawer | Draw calls | Forward+, a MeshRenderer, no property block | Hybrid Batch Group |
| Static batching | Draw calls | Batching Static; pays in mesh memory | Static Batch |
| SRP Batcher | SetPass calls | A compatible shader, no property block | SRP Batch |
| GPU instancing | Draw calls | The SRP Batcher not taking the renderer | Draw Mesh (instanced) |
| Dynamic batching | Draw calls | Meshes under 300 vertices; leave it off | Draw Dynamic |
MaterialPropertyBlock takes a renderer out of the SRP Batcher and the resident
drawer. For a state many objects share — every armed hazard — swap to a second shared
material. The audit's propertyBlocks.paths lists the renderers, in play mode.Every path's requirements, the resident drawer's settings and material consolidation:
reference/batching.md.
Cheapest test: halve QualitySettings.lodBias for one window. No change in the triangle
median means the scene has no levels to fall back to: the audit's lod.groupTriangleShare is
the share of triangles under a LODGroup, and lod.heaviestWithout the ten meshes to start on.
resources/Editor/LodGroupBuilder.cs builds the group from children named _LOD0 …
_LODn; it reports levels, triangles and heights and waits for confirmation.LODGroup (from _LODn names) has to be removed at prefab build.lodBias and maximumLODLevel are per quality tier: 0.6 and 1 on the low tier, 1.0 and
0 on medium, 2.0 and 0 on desktop.Making the lower meshes is unity-3d-models → reference/import-and-decimate.md. The distance
formula, cross-fade and the two mechanisms compared: reference/lod.md.
Cheapest test: with the runner facing the wall, deactivate the rooms that cannot be seen and take one window. That is the most occlusion culling can return. If the counters barely move, stop.
resources/Editor/OcclusionBake.cs reports the flagged counts and settings, waits,
bakes, and reads the data size back. Zero occluders is refused.OcclusionPortal, opened and closed by the switch. A moving thing is
never a baked occluder.Accept a culling change only with a second window looking through the doorway, where the
counters must not have fallen. reference/occlusion.md.
reference/distance-texture-fill.md§4 per-layer cull distances and a second camera's culling mask; §5 texture size and mipmap streaming; §6 overdraw, fill and 2D draw cost. Same numbering there.
| File | Does |
|---|---|
resources/Editor/SceneCostAudit.cs | Read-only, one JSON object: triangles by layer, materials and shaders, property blocks, static-flag and LOD coverage by triangle share, shadow-casting lights, large textures that do not stream, camera culling, sprite and tilemap modes |
resources/Editor/LodGroupBuilder.cs | Plan(root) reports, Build(root) writes a LODGroup from _LOD0 … _LODn children |
resources/Editor/OcclusionBake.cs | Plan() reports flagged renderers and settings; Bake(…) bakes and returns the data size |
Menu root: Tools → Unity Dev → Scene Optimisation. Editor folder, no package. SRP Batcher compatibility is not readable from public script API: read it on the shader's inspector.
Situation approach-gate seed=7 · editor-windowed · 90 frames, 30 warm-up, 3 windows each
Counter Render/Triangles Count median 1.84 M looking down the lane
Test lodBias 1.0 → 0.5: 1.84 M → 1.79 M (no LODGroup under 81% of the triangles)
Change LODGroup on LaneBarrier, 3 levels 0.5 / 0.2 / cull 0.01 — 240 instances
Result triangles 1.84 M → 0.61 M (-66.8%) · draw calls 412 → 418 · ft_p95 12.9 → 9.4 ms
Open cross-fade off: the swap at 8.7 m pops; device window not taken
The counter, the test that showed the lever was real, one change, the counter again, what was not covered.
| Not here | Go to |
|---|---|
| Taking the window, listing counters, the before/after table itself | unity-profiling |
| Decimating a mesh, glTF import, a model's triangle budget | unity-3d-models |
| Shadow distance, cascades, which lights cast, baking light | unity-lighting |
| Modular kits, trim sheets, collision proxies | unity-3d-level |
| Post-processing cost, renderer features, URP not active | unity-render-urp |
| Packing sprites into an atlas | unity-sprite-atlas |
| Sorting layers, 2D lights, sprite masks · sprite outlines | unity-2d-rendering · unity-2d-sprites |
| A canvas that rebuilds every frame | unity-game-ui · unity-ui-ugui |
| Build size and stripping · a window on the phone | unity-android-release · unity-web-release · unity-device-testing |
| Deciding the frame and memory budget | unity-game-brief |
reference/2d-draw-cost.md (opens in a new tab)reference/batching.md (opens in a new tab)reference/culling-distances.md (opens in a new tab)reference/distance-texture-fill.md (opens in a new tab)reference/lod.md (opens in a new tab)reference/occlusion.md (opens in a new tab)reference/texture-streaming.md (opens in a new tab)resources/Editor/LodGroupBuilder.cs (opens in a new tab)resources/Editor/OcclusionBake.cs (opens in a new tab)resources/Editor/SceneCostAudit.cs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
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.