Creating an Audio Manager in Unity

How to have more control of the music, voices and SFX

Rusben Guzman
2 min readJan 1, 2022

Objective: Create an Audio Manager Object and use it to play the audio clips in the VO triggers.

First we have to create a new game object called AudioManager, create a script with the same name and assign it to the audio manager. Also we are gonna have some child objects within the audio manager, those objects must have the AudioSource component (in this case i just create one child for the voice over).

The audio manager script will be a singleton so we have to create a private variable for the instance, a public property to access to this value and initialize the variable in the awake function.

In this same script I create a variable to store the Audio Source of the child object to play the voice over clips. Then we have to create a function that receives an AudioClip as a parameter, within the function we assign that clip to the audio source and then play it.

In the voice over trigger script I just use the function of the Audio Manager to play the audio.

And that’s it!!! We have a better way to play audio in our game.

--

--

Rusben Guzman

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.