Skills

Optimize Audio

Optimizes audio memory, CPU cost, and playback quality through import settings and...

Install

npx skills add Unity-Technologies/skills --skill optimize-audio -g -a claude-code -y
Category
Media
Updated
5d ago
License
See repository
Context cost
Mediumabout 3,000 tokens
Runs scripts
No, instructions only

What it does

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.

Critical Rules

  • Do not make changes before reporting findings to the user
  • Follow steps in strict order; never jump ahead
  • STOP at every WAIT checkpoint and await the user's response before continuing
  • Quality is more important than speed: measure before and after every change
  • Always verify results in a device build; Editor audio stats are indicative only

0. Set up the execution path

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:

  • You need script eval in particular, not just a reachable Editor. Confirm it appears in the 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.
  • Do not hand-edit .meta files to change import settings. Importer values only take effect 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 script eval --code '<snippet>'. Discover the parameter shape from unity command --format json rather than assuming one. unity command defaults to a 30 second timeout.

Passing C# to script eval

script eval compiles a statement block, not a file. Two consequences, both of which cause a compile error rather than a warning:

  • No using directives. The compiler reads using UnityEngine; as a resource-disposal statement and rejects it (CS0210).
  • Types must be fully qualified. A bare AssetDatabase or AudioImporter does not resolve (CS0246 / CS0103), and a bare Object is ambiguous with object (CS0104).
Read the whole SKILL.md on GitHub

More in Media