globe-pointerComplete Audio Manager Tutorial

What is the Audio Manager?

The Audio Manager is the core brain of your entire audio system. It's a singleton component that controls all audio playback, manages audio sources, handles volume settings, and provides the API for playing sounds throughout your game.

Finding the Audio Manager

After Quick Setup:

  • Look in your Hierarchy for "USM" GameObject

  • Select it to see the USM component in the Inspector

Manual Check:

  • If no USM exists, go to Tools → USM → Quick Setup

Understanding the Audio Manager Components

Main Settings in Inspector:

Configuration Section:

  • Audio Library: Reference to your audio database

  • Initial Pool Size: Number of audio sources to create (default: 20)

  • Global Volume: Master volume affecting all sounds (0.0 to 1.0)

  • Music Volume: Volume for music tracks only (0.0 to 1.0)

  • SFX Volume: Volume for sound effects only (0.0 to 1.0)

What Each Setting Does:

Audio Library:

  • This is the database containing all your audio assets

  • Automatically assigned during Quick Setup

  • Contains all your SFX and Music definitions

Initial Pool Size:

  • Pre-creates this many Audio Source components

  • Prevents runtime allocation stalls

  • 20 is good for most games, increase for audio-heavy games

Volume Controls:

  • Global Volume: Affects EVERY sound (like master volume on a stereo)

  • Music Volume: Only affects music tracks

  • SFX Volume: Only affects sound effects

  • All volumes are multiplied together for final output

How the Audio Manager Works

The Singleton Pattern:

  • Only ONE Audio Manager can exist per scene

  • Automatically available via USM.

  • Accessible from anywhere in your code

  • Survives scene changes if configured

Audio Source Pooling:

  • Creates a pool of Audio Source components at startup

  • Reuses them instead of creating/destroying constantly

  • Prevents audio crackles and performance issues

  • Automatically manages free audio sources

Smart Audio Management:

  • Automatic cleanup: Stops finished sounds and returns sources to pool

  • Volume mixing: Applies global + category + individual volumes

  • Priority system: Manages limited audio hardware resources

  • Spatial audio: Handles 2D and 3D sound positioning

Basic Audio Manager Setup

Step 1: Initial Configuration

  1. Select the USM in Hierarchy

  2. In Inspector, set your preferred volumes:

    • Global Volume: 1.0 (full volume)

    • Music Volume: 0.8 (80% - typically lower than SFX)

    • SFX Volume: 1.0 (100% - sound effects at full volume)

Step 2: Pool Size Adjustment

  • For simple games: 10-15 audio sources

  • For action games: 20-30 audio sources

  • For audio-intensive games: 30-50 audio sources

  • Don't set too high - wastes memory

Step 3: Audio Library Assignment

  • Make sure the Audio Library field is assigned

  • If empty, click the circle and select your Audio Library asset

  • Usually found at: Assets/Kitler dev/USM/Data/

Playing Sounds with the Audio Manager

Method 2: Builder Pattern (Advanced Control)

Method 3: Using Auto-Generated Names

Your created Audio will show here in the Audio.Sounds

Music Management

Playing Background Music:

Music Control Methods:

Advanced Audio Features

Audio Ducking (Automatic Volume Control)

Global Volume Control

Audio State Management

Performance Optimization

Best Practices:

Pool Size Management:

  • Start with 20 audio sources

  • Monitor performance in complex scenes

  • Increase if you hear sounds cutting out

  • Don't exceed 50 unless absolutely necessary

Memory Management:

  • The Audio Manager automatically cleans up finished sounds

  • No manual memory management required

  • Audio sources are reused efficiently

CPU Optimization:

  • Spatial audio (3D sounds) use more CPU

  • Keep most UI sounds as 2D (spatial blend = 0)

  • Use audio compression on source files

  • Limit simultaneous complex audio effects

Last updated