Audio

The audio system aims to make sound management easy in your projects.

Structure:

Games largely consist of music, sound effects and voice overs. To reflect these, their respective audio files should be placed inside:

Music: Assets/Resources/Audio/Music

SFXs: Assets/Resources/Audio/SFXs

VOs: Assets/Resources/Audio/VOs

Playing audio:

To play your sounds, use PlayMusic, PlaySFX and PlayVO from the Audio script. Pass along your filename, and if the set up is correct, you should hear the audio being played. Music tracks will loop by default. You can use the once properly to change that.

Custom paths:

Sometimes, you may wish to play audio files from custom directories. The play methods in our Audio script enables this with two parameters:

prePath: The path before the base directory. For example, if you pass along "Assets/Resources/CustomPath" as the prePath, the script will search inside: "Assets/Resources/CustomPath/Music(or SFXs/VOs)".

postPath: The path after the base directory. For example, if the postPath for a VO file is "Deaths", the code will look inside this folder: Assets/Resources/Audio/VOs/Deaths.

Volume control:

AudioConfigs, extending from the Config system, allows for volume control. There are four adjustable attributes: master volume, music volume, sfx volume and vo volume. The Audio component will use these properties to determine how loud to play each sound. Whenever these values change, you may use ConfigManager.Instance.Save to store those updates.

Required:

Core

Config