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

Do you want to see a list of the audio references on the default "AudioManager" prefab? Click the link below:

Last updated