2d-pixel-perfect
Sets up, diagnoses, and fixes pixel perfect 2D rendering with PixelPerfectCamera in URP or Built-in. Use when a retro-style or…
Optimizes audio memory, CPU cost, and playback quality through import settings and mixer configuration. Use when asked to reduce audio memory or Audio Mixer CPU cost, change clip Load Types, sample rates or codecs, or force 3D audio to mono.
$ npx -y skills add unity-technologies/skills --skill optimize-audio --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/optimize-audioContext preview
The summary Claude sees to decide when to auto-load this skill.
Optimizes audio memory, CPU cost, and playback quality through import settings and mixer configuration. Use when asked to reduce audio memory or Audio Mixer CPU cost, change clip Load Types, sample rates or codecs, or force 3D audio to mono.
name: optimize-audio description: Optimizes audio memory, CPU cost, and playback quality through import settings and mixer configuration. Use when asked to reduce audio memory or Audio Mixer CPU cost, change clip Load Types, sample rates or codecs, or force 3D audio to mono.
Every C# step below runs inside a live Editor through the Unity CLI. **The `unity-cli` skill owns getting you there** — installing the CLI, confirming a connected Editor, adding the project's `com.unity.pipeline` package, telling a genuinely absent Editor apart from one stuck in Safe Mode, and discovering the Editor's command catalog. Follow it first; don't re-derive any of it here.
Two things it can't know for you:
catalog. Its presence depends on the Pipeline package version, not on the CLI, so a healthy install can still lack it — if it's missing, say so and stop.
through `SaveAndReimport()` in a live Editor, so an unreachable Editor is a stop, not a cue to edit metadata directly.
Run C# with `unity command eval --code '<snippet>'`. Discover the parameter shape from `unity command --format json` rather than assuming one. `unity command` defaults to a 30 second timeout.
`eval` compiles a **statement block, not a file**. Two consequences, both of which cause a compile error rather than a warning:
statement and rejects it (`CS0210`).
(`CS0246` / `CS0103`), and a bare `Object` is ambiguous with `object` (`CS0104`).
The recipes in [resources/audio-import-api.md](resources/audio-import-api.md) are written fully qualified so they can be passed to `eval` as-is.
Before doing anything else, establish the audio environment:
1. **Detect platform and sample rate:** Use `eval` to read `EditorUserBuildSettings.activeBuildTarget` and `AudioSettings.outputSampleRate`. The output sample rate affects whether overriding clip sample rates will actually save memory. 2. **Detect AudioMixer presence:** Use the mixer-asset query recipe in [resources/audio-import-api.md](resources/audio-import-api.md) to see if a mixer graph exists. If none exists, note that routing and effect costs are not a concern. 3. **Detect AudioListener:** Use the scene-component query recipe in [resources/audio-import-api.md](resources/audio-import-api.md) for `UnityEngine.AudioListener` to confirm exactly one listener is present. Multiple listeners produce incorrect spatialization; zero listeners produce silence. 4. **Proceed** only after platform and listener state are confirmed.
Before recommending any change, gather observable data:
1. **Find all AudioSources:** Use the scene-component query recipe in [resources/audio-import-api.md](resources/audio-import-api.md) for `UnityEngine.AudioSource`. For each result, use **one** `eval` call to batch-read properties — see the batch read recipe in [resources/audio-import-api.md](resources/audio-import-api.md). 2. **Inspect mixer topology:** If a mixer was found in Pre-Flight, use `eval` to read the AudioMixer's exposed parameters and group count. A group count above ~8 or effects on the Master group are immediate flags. 3. **Check DSP buffer size:** Use the DSP buffer recipe in [resources/audio-import-api.md](resources/audio-import-api.md) to read buffer size. See DSP Buffer Size Guidelines in [resources/platform-settings.md](resources/platform-settings.md) for recommended values. 4. **Report findings before making changes:** Summarize ALL detected sources, the listener count, and mixer depth to the user. Flag any immediate risks (e.g., stereo clip with `spatialBlend = 1`, Decompress On Load on a clip > 1 MB, reverb on the Master group).
**WAIT for the user to review the assessment before proceeding.**
Route to the correct section based on what the user needs:
| User Says | Path | |-----------|------| | "audio memory too high" / "memory profiler shows audio" | Section 4 — Import settings audit | | "load times slow" / "decompression stall" | Section 4 — Load Type review | | "DSP spike" / "mixer CPU" / "audio CPU high" | Section 4B — Mixer audit | | "3D sound wrong" / "only left channel plays" / "stereo in 3D" | Section 4A — Force To Mono + spatial settings | | "quality artifacts" / "voice sounds bad" / "Vorbis crackling" | Section 4C — Compression quality tuning | | "mobile audio battery" / "mobile memory" | Section 4D — Mobile sample rate override | | "set import settings on all clips" / "batch audio settings" | Section 4 — Bulk import audit | | "streaming" / "background loading" / "Addressables audio" | Section 4E — Streaming and async load |
If the symptom is ambiguous, ask: "Is the problem audio memory usage, DSP CPU spikes, or audio playback quality?"
Use the findings from Section 2 to determine which sub-section applies. More than one may apply simultaneously.
For any AudioSource where `spatialBlend > 0` (3D positioned sound):
1. **Check clip channel count:** Use `eval` to read `audioSource.clip.channels`. If `channels == 2` and `spatialBlend == 1`, only the left channel plays — this is a bug, not a feature. 2. **Recom
A collection of reusable AI agent skills for Unity workflows. Compatible with Claude Code, GitHub Copilot, Cursor, Cline, and 50+ other agents.
Sets up, diagnoses, and fixes pixel perfect 2D rendering with PixelPerfectCamera in URP or Built-in. Use when a retro-style or…
Imports 3D models and point clouds with Asset Transformer Toolkit (formerly Pixyz), and creates, edits, and runs RuleSets,…
Routes Audio Sources into existing Audio Mixer Groups, classifying each source by what it plays. Use when the user asks about…
Builds node-based Editor tools with Unity Graph Toolkit (GTK) on Unity 6.6+: graphs, nodes, ports and validation, State Machine…
Builds and operates live games with Unity Services. Use when the user asks about backend or live-ops features such as player…
Creates and fixes Unity 2D physics in both systems, 2D Physics Core and the legacy Rigidbody 2D system. Use when the user asks…