UGTK cat mascotUGTKengine within an engine Request access

UGTK / Toolkit / Gameplay Systems / Audio System Completed

Gameplay Systems — UGTK

Audio System

Summary

The Audio System is a powerful tool for managing and manipulating game audio within Unity. It offers advanced control over audio playback, including play, pause, resume, stop functions, and dynamic volume adjustments across different audio channels. The system utilizes audio pooling to handle playback efficiently, activating and deactivating audio sources as needed.


Content


Modules Dependencies

The Audio System module requires the following dependencies:

Ensure that these dependencies are correctly imported and configured in your project.

Carried inside the prefabs. These modules are not referenced by the assembly definition - the components are simply already attached to the prefabs this module ships. Remove one of them from the project and the prefab keeps its layout and loses that behaviour, with nothing in the console to say so.

Module Component, and the prefab carrying it
UIModule/TextUpdaterSystem Mn_TextUpdater (in AudioModifier)
UtilitySystems/ActivationSystem Mn_GameObjectActivation (in AudioTotalScreen)

Setup

To set up the Audio System, follow these steps:

Audio Manager

  1. Add AudioManager prefab to your first scene:

  1. Set up Audio Settings channels:


Audio Database

  1. Create a new Audio database

2.Add the database to AudioManager

3.Create new Audio


How To Use

To use the Audio System, call the Mn_AudioManager public API (no static event bus):

  1. Reproduce Audio:
     Mn_AudioManager.Instance.Play("MyAudioID");
  1. Pause Audio:
     Mn_AudioManager.Instance.Pause("MyAudioID");
  1. Resume Audio:
     Mn_AudioManager.Instance.Resume("MyAudioID");
  1. Stop Audio:
     Mn_AudioManager.Instance.Stop("MyAudioID");

To modify volumes, call:

  1. Volume Change:
     Mn_AudioManager.Instance.SetChannelVolume(E_AudioChannelType.Master, 0f);
     Mn_AudioManager.Instance.SetChannelVolume(E_AudioChannelType.Music, 0f);
     Mn_AudioManager.Instance.SetChannelVolume(E_AudioChannelType.Environment, 0f);
     Mn_AudioManager.Instance.SetChannelVolume(E_AudioChannelType.Effects, 0f);
  1. Mute Channel:
     Mn_AudioManager.Instance.MuteChannel(E_AudioChannelType.Master);
     Mn_AudioManager.Instance.MuteChannel(E_AudioChannelType.Music);
     Mn_AudioManager.Instance.MuteChannel(E_AudioChannelType.Environment);
     Mn_AudioManager.Instance.MuteChannel(E_AudioChannelType.Effects);
  1. Unmute Channel:
     Mn_AudioManager.Instance.UnmuteChannel(E_AudioChannelType.Master);
     Mn_AudioManager.Instance.UnmuteChannel(E_AudioChannelType.Music);
     Mn_AudioManager.Instance.UnmuteChannel(E_AudioChannelType.Environment);
     Mn_AudioManager.Instance.UnmuteChannel(E_AudioChannelType.Effects);

Testing Scene

Open AudioScene in the module's Debug/ folder and select AudioManager. The Play test and Active sounds blocks need Play mode, and outside it they say so rather than showing an empty list.

What to do, in order:

  1. Pick a Track Id - the block reports the clip length - and press Play. Active sounds lists it with its routing (2D · Music here) and a bar that follows the playhead. Stop empties the list again.
  2. Play a clip from each category and check it lands on the right mixer group.
  3. Move the volume sliders and confirm each affects only its own group.
  4. Play many clips at once, past the number of available sources.
  5. Stop play and restart: the saved volumes should come back.

Step 4 is where a pooled audio system shows its limit: it either drops the new sound or steals a playing one, and which one it steals is very audible if it picks the music. Step 5 catches the common oversight of volumes that are applied but never persisted.


Technical Info

The following are the main scripts and workflow of the Audio System. Refer to the UML section for the detailed structure.

Scripts:


© 2026 Marcello De Bonis. All rights reserved

Real dependenciesOpen in the map →

Measured from the repository: code references (asmdef) plus prefab and asset GUIDs. Importing this module alone brings in 13 modules in total.