Audio_Controller_Example

The Audio Management System from a small project I worked on called ROTA.
ROTA by Erich Kohlweg: http://gamejolt.com/games/rota/46815
Originally made in untiy 4.6
Recompiled for Untiy 5.1

How This Works

The Audio for the game is handled with 2 sound sources and 4 Audio Classes

1. SFX Master

https://github.com/DaniKog/Audio_Controller_Example/blob/master/Assets/Scripts/Audio/SFXMaster.cs
The SFX Master handles all the SFX in the game, it is a prefab that has one audio source and it assigns the right clip before playing it.

2. UI_Audio

https://github.com/DaniKog/Audio_Controller_Example/blob/master/Assets/Scripts/Audio/UI_Audio.cs
This class handles all the UI audio. This prefab has a sound source as well, it plays UI sounds when needed.

3. Mixer

https://github.com/DaniKog/Audio_Controller_Example/blob/master/Assets/Scripts/Audio/Mixer.cs
Mixer class is an improvised mixer, a list of floats that save the volumes of each SFX and changes the voliume of the sound source before playing the sound. It was done before Untiy 5 came out with it's own mixer.

4. Audio Manager

https://github.com/DaniKog/Audio_Controller_Example/blob/master/Assets/Scripts/Audio/AudioManager.cs
The instance of this class only exists on the main menu. It checks if the other classes exist in the scene and creates them from resources if they don't.