Unity Audio Scripts

1 free C# script 1 intermediate Unity 2022.3+ MIT licensed

Most Unity projects end up with sounds scattered across AudioSources on dozens of objects, and music that cuts out on every scene load. The Audio Manager in this category puts playback behind one component that survives scene changes.

It crossfades between music tracks, plays sound effects from a pool of AudioSources instead of creating new ones, and keeps music and effects volume as separate settings. It is a single script, so it is also a readable starting point if you would rather build your own.

Start with Audio Manager

Complete audio manager with music crossfade, SFX pooling, volume control, and persistence.

AudioManager.cs · 6 Inspector fields · intermediate

Open Audio Manager
AudioManager.cs
Script AudioManager
Audio Sources
Music Source A None (AudioSource)
Music Source B None (AudioSource)
Sfx Pool Size 10
Settings
Music Volume 0.7
Sfx Volume 1
Crossfade Duration 1.5

All 1 audio script

What these scripts need

Read from each script's source, so this list stays in step with the code.

  • Calls DontDestroyOnLoad, so the object survives scene loads. Place it once, in your first scene.

    All of them: Audio Manager

Guides that use them