Balancing in-game audio with Ducking

As much as the background music can be important in establishing the right atmosphere, there will be times when other audio clips should be emphasized, and the music volume turned down for the duration of that clip. This effect is known as Ducking. Maybe you will need it for dramatic effect (simulating hearing loss after an explosion took place), or maybe you want to make sure that the player listens to a specific bit of information. In this recipe, we will learn how to emphasize a piece of dialog by ducking the audio whenever a specific sound message is played. For that effect, we will use the new Audio Mixer to send information between tracks.

Getting ready

For this recipe, we have provided the soundtrack.mp3 ...

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.