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:

  1. Import Volume.unitypackage into your project.
  2. Open the Volume scene (available in the Assets | Volume folder). Play the ...

Get Unity 5.x Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.