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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.