Adding volume control with Audio Mixers
Sound volume adjustment can be a very important feature, especially if your game is a standalone. After all, it can be very frustrating to access the operational system volume control. In this recipe, we will use the new Audio Mixer feature to create independent volume controls for Music and Sound FX.
Getting ready
For this recipe, we have provided a Unity package named Volume.unitypackage
, containing an initial scene featuring soundtrack music and sound effects. The file is available inside the 1362_09_05
folder.
How to do it...
To add volume control sliders to your scene, follow these steps:
Import
Volume.unitypackage
into your project.Open the Volume scene (available in the Assets | Volume folder). Play the scene and walk towards the semitransparent green wall in the tunnel, using the W A S D keys (while pressing the Shift key to run). You will be able to listen to:
A looping soundtrack music
Bells ringing
A robotic speech whenever the character collides...