Audio#
Summary
The Audio Manager configures pooled Audio Sources from Play Instructions, then reclaims each source when its sound ends. Choose a resource and channel without placing a separate Audio Source in the scene.
The five Play Instructions#
There's one Instruction per channel, under Audio in the Instructions dropdown.
| Instruction | Plays on | Suits |
|---|---|---|
| Play Sound Effect | Sound Effect | Footsteps, impacts, gunshots, a door closing. |
| Play Ambient | Ambient | Wind, rain, a crowd, the hum of a generator. |
| Play Music | Music | The score. |
| Play Voice | Voice | Dialogue, barks, grunts. |
| Play UI | UI | Button clicks, menu confirmations, chimes. |
All five share the same playback behavior. Their channel and initial field values differ:
| Instruction | Loop | Fade in | Clock | Spatial blend | Has Target |
|---|---|---|---|---|---|
| Play Sound Effect | No | 0 |
Game Time | 1 — 3D |
Off |
| Play Ambient | Yes | 3 |
Game Time | 1 — 3D |
On |
| Play Music | Yes | 3 |
Real Time | 0 — 2D |
Off |
| Play Voice | No | 0 |
Game Time | 1 — 3D |
On |
| Play UI | No | 0 |
Real Time | 0 — 2D |
Off |
Random pitch varies repeated effects
Play Sound Effect starts with a random Pitch between 0.95 and 1.05 instead of a fixed 1. This variation keeps repeated shots from sounding like one recording in a loop.
Each default is an editable field. For example, Play Music can produce a one-shot 3D sound from a radio instead of a looping 2D track. Playing a sound covers every field.
Sources are pooled#
When you play a sound, the Audio Manager takes an Audio Source from its pool. When the clip finishes, the manager disables the source and returns it to the pool.
The pool grows to the highest number of concurrent sounds reached during the session. After that peak, Visual Script reuses sources instead of creating and destroying one for every sound.
Unity still has a voice limit
The pool has no fixed capacity limit, but Unity limits how many voices it plays at once. Beyond that limit, lower-priority sounds become virtual: they keep their playback position but produce no sound. Use Priority to indicate which sounds should remain audible.
Loops need an explicit stop#
A looping sound continues when you leave the zone that started it or load a different scene. This lets music continue across scene transitions, but it also means you need to decide when each loop should stop. See Stopping a sound.
Try it#
- Put Play Music on an On Start Event with a looping track, and listen to the three-second fade in.
- Put Play Sound Effect on an On Keyboard Press, press the key a dozen times in a row, and listen to the pitch variation between repeats.
- Set the time scale to
0.25while a sound effect and a music track are both playing. With the default Time settings, the effect drops in pitch while the music stays unchanged. - Play an ambient loop with Has Target pointed at a game object, then end it with Stop Audio on Game Object and a two-second fade.
- Wire a uGUI slider to the Music Volume Signal with an On Slider Change Event, then add a Save Shared Instruction beside it. The slider now controls music volume and preserves its value across restarts.
Where to go next#
- Channels — control category and Master volumes, routing, and final loudness.
- Playing a sound — configure playback, timing, spatial settings, and ownership.
- Stopping a sound — select sounds to stop and control their fade-out.
- Audio API — call
AudioManagerandVolumeManagerfrom C#.