Qookie Games
Simple Audio Manager UI Documentation
How to import the Template
Once you’ve downloaded the template, open Unity and navigate to Assets > Import Package > Custom Package. Select the Unity asset file that you downloaded, and be sure to import all packages.
How to Use the Asset
You can access the Demo scene to check how this asset work by going to Assets>Plugins>Qookie Games>AudioManager>Scene
To use this asset in your game, go to Assets > Plugins > Qookie Games > AudioManager > Prefabs. Drag and drop the AudioManager.prefab gameobject into the first loaded scene of your project (the scene with index 0). This gameobject will remain active in all your scenes to manage the audio.
To add the audio control buttons, drag and drop the AudioManagerButtons prefab into your canvas. This will add buttons to mute sound effects (SFX) and music.
Note: This functionality will only work if there is exactly one music track in the game, the music track is named “music”, and it is added to the AudioManager.
How to add sounds/music
When you add the AudioManager gameobject, click on it and press the plus icon to add more audio.
You can only add one music track, and its name should be “music” with the loop checkbox checked.
When adding other sound effects (SFX), uncheck the loop checkbox to prevent them from repeating.
You can also control the volume and pitch of each audio track.
Control music and audio with script
First, add using QAudioManager; in the script where you want to use the asset.
To play an audio, use this line:
FindObjectOfType<AudioManager>().Play(“audioname”);
To pause an audio, use this line:
FindObjectOfType<AudioManager>().Pause(“audioname”);
To resume an audio, use this line:
FindObjectOfType<AudioManager>().UnPause(“audioname”);
To stop an audio, use this line:
FindObjectOfType<AudioManager>().Stop(“audioname”);
To change the audio volume, use this line:
FindObjectOfType<AudioManager>().Volume(“audioname”, 1);
To change the audio pitch, use this line:
FindObjectOfType<AudioManager>().Pitch(“audioname”, 1);
“audioname” is the name that is assigned in the AudioManager gameobject.