Step 2.5 - Audio Manager

Adding the Audio Manager

Add the "AK_AudioManager" from the prefabs folder or the "Adventure_Kit_Managers" pack to add all to the hierarchy. You can add the "AK_AudioManager" script to an empty gameobject if you want to start fresh.

Adding more elements / tracks to the Audio Manager

Adding more audio clips: On the Audio Manager you can increment the "Size" value of the manager array to add a new element so you can add more 2D sounds.

How to reference the Audio Manager?

//Add this namespace to the top of the script to reference the adventure kit
using AdventurePuzzleKit;
//How to play a sound using the name of your audio from the array
AKAudioManager.instance.Play("YourAudioClip");
//How to stop playing a specific audio clip
AKAudioManager.instance.StopPlaying("YourAudioClip");

NOTE: Most Systems will now have variables which allow you to change audio names in the inspector without going into code but this is how you would do it manually!

Screenshot of the Audio Manager

Details of the settings of the Audio Manager

Name

The name of the audio clip you will reference in code

Clip

Add the sound effect from the "Sounds folder" to this slot

Empty Box

Volume

The volume of your audio clip

Default :1

Volume Variance

Default can be set to 0.

Default: 0

Pitch

Setting the Pitch of your audio clip

Default: 1

Pitch Variance

The default variance of the audio pitch

Default: 0

Loop

Set whether you want the audio clip to loop

Tickbox

Mixer Group

If you want to keep the mixer group for audio

Mixer Group

Audio Reference List

Last updated

Was this helpful?