# 4. Interactable Audio Pitfalls and Quest Part of [[Interactable Audio]]. Previous: [[3. Interactable Components with Audio]]. Mixer-side pitfalls: [[5. Audio Mixer Pitfalls]]. > [!note] Verification status > Items citing the reference were read in the 6000.5 docs on 2026-11-07 (`PlayClipAtPoint` creates and disposes its own source; `priority` virtualization; `ObjectPool` `maxSize` behaviour). Others are practical experience. Quest projects target Unity 6.3 LTS ([[0.Choosing a Unity Version]]); the APIs used here exist in 6000.5 and are long-standing, but re-check on 6000.3. **No code compiled.** | Symptom | Cause | Fix | |---|---|---| | Machine-gun / flanging when many props hit at once | Same clip started on the same frame many times | Per-sound `cooldown` + `maxInstances`; pitch jitter; Random Container with Avoid Repeating Last | | Interactable sounds ignore the SFX slider / pause snapshot | `PlayClipAtPoint` - no mixer group (reference: it creates its own source) | Use the pooled service; route every `InteractionSound.output` | | Break sound cut off instantly | Source was on the destroyed object | Play via pooled emitter at the position (Part 3.6) | | A pooled sound plays with the last sound's pitch/loop/group | Emitter not fully reconfigured | `Begin` sets *every* field; `ResetForPool` clears loop/resource | | A loop never stops | Lost its handle, or Stop called on a stale handle | Keep the `AudioHandle`; generation check makes stale stops harmless; `StopAll` on scene change | | Sounds keep playing after unloading a level | Service is `DontDestroyOnLoad` | Call `AudioService.Instance.StopAll(0.2f)` from your scene loader ([[SceneManagement in Unity 6]]) | | Double impact on every collision | Both bodies have `ImpactAudio` | Put it on one side, or dedupe per frame | | Rolling objects spam impacts | Continuous contact re-enters | Higher `minSpeed`, per-object cooldown, add a separate rolling loop driven by angular velocity | | Important sounds sometimes silent in big fights | Voices exhausted; low priority virtualized | Priorities on `InteractionSound`, global cap below real voices (Part 2) | | GC spikes on pickups | `PlayClipAtPoint` / Instantiate per sound | Pool; prewarm | | Pool keeps growing then destroys emitters | `maxSize` reached - extra releases destroyed (reference) | Raise `maxSize` to your expected peak, or lower the cap | ## Meta Quest 2 notes - **Budget voices tightly.** Mobile CPU; every real voice and DSP effect costs. Start with a global pooled cap around 24 and measure with the Profiler's Audio module on device (see [[5.Quest 2 Performance and Rendering]] and [[4.Quest 2 Testing and Deployment]] for running on hardware). - **Spatialization matters more in VR** - interactables in reach (0.3-1 m) need `minDistance` ~0.3-0.5 so they don't blast; hand-held items should *follow* the hand transform (pass `follow` to `AudioService.Play`). Spatializer plugins (Meta XR Audio etc.) are covered by the planned spatial-audio tutorial in the [[Audio]] series. - **Haptics + audio together:** a controller pulse on the same frame as the click sells the interaction ([[6.Quest 2 Input Hands and Passthrough]]). - **Diegetic UI clicks** (wrist panels, terminals - [[6.Diegetic Terminal and Wrist Display]]) should be 3D at the panel, not 2D UI sounds. ## Teaching exercise (Level 12 + Level 16) Build a corridor with three hazards from [[4. Physics 2D Effectors and Joints]] or the 3D equivalent. Version A: no audio. Version B: wind-up telegraph sounds 0.75 s before each hazard. Have classmates play both and count deaths. The telegraph should cut deaths sharply - audio as fair warning. ## Docs - `AudioSource.PlayClipAtPoint`: https://docs.unity3d.com/6000.5/Documentation/ScriptReference/AudioSource.PlayClipAtPoint.html - `AudioSource.priority`: https://docs.unity3d.com/6000.5/Documentation/ScriptReference/AudioSource-priority.html - `ObjectPool<T>`: https://docs.unity3d.com/6000.5/Documentation/ScriptReference/Pool.ObjectPool_1.html - Audio profiler module: https://docs.unity.com/en-us/engine/6000.5/manual/audio/profiler