Skip to content

Audio Manager

AlexanderMcCord edited this page Sep 21, 2022 · 3 revisions

The script controls all the audio from the game. For the background music, there is a simple fade effect on changing between the two backgrounds.

If you want to play a sound effect, just call the AudioManager.Instance.PlaySound(...) function, passing in the desired audio clip and a volume level with a default volume of 1.0 (on a scale from 0.0 to 1.0), which is the max level:

public void PlaySoundEffect(AudioClip clip, float volume = 1f)
{
    m_sfxSource.PlayOneShot(clip, volume);
}

This class is persistent singleton that gets initialized on the Menu scene in the project: AudioManagerOnMenuScene

In case it is needed to change the background music, the max music volume, or other audio/music settings, modify them in this scene: AudioManagerOnHeirarchy