My journey becoming a Unity game developer: Audio Manager: Background Music, Game Over Cutscene Voice Over and Music
Objective: Add background music to the game as it’s playing. Also, add captured music and Oliver’s voice over clip when the player is captured in the Game Over Cutscene.
To add background music to the game, begin with creating an Empty game object name Background Music inside the Audio Manager game object. Make sure to set the Transform positions to zero. Add the Audio Source component, drag the background music audio clip that will be used into the Audio Clip’s slot which will be Ambient Background audio clip in this case, and turn on the Loop setting to have the background music play repeat playing in the game.
Inside the Audio Manager, adjust the VO and Background Music objects volume down to .25 and .20 respectively. This is to bring down the sound as it can be overwhelming listening to these 2 audio clips while playing the game.
For the Game Over Cutscene we want to add special music when the player is captured. Also, we want to add audio of Oliver telling Darren to hang in there, help is on the way.
Inside of the Game Over Cutscene game object, create a new Empty game object name Audio. Set Transform positions to zero if needed, then create 2 new Empty game objects inside of the Audio object. Their names will be VO for voice over and Music for the captured music that will play. Make sure both of their Transform positions are set to zero.
Add Audio Source components to each VO and Music objects. For the VO object’s Audio Source, we will add the Darren is Caught audio clip to the Audio Clip slot. The Music object’s Audio Source we will add the Discovery Stinger music audio clip into its Audio Clip’s slot.
To use the VO and Music game objects in the Game Over Cutscene, open the Timeline editor for the Game Over Cutscene. Create 2 Audio Tracks for each of the game objects and drag the VO and Music objects into each. Place the 2 audio clips used for each object in their Audio Source component in their timeline. Either right-click in the timeline and select Add Audio Clip or dragging the audio clips from the Assets folder into the timeline itself. Make sure to drag the audio clips to the beginning of the frame.
We want the VO audio clip to play as Darren places his hands on top of his head. Drag the Darren is Caught audio clip to the point where Darren’s hands are above his head.
For the audio to play correct in the Game Over Cutscene, in the VO’s Audio Source component we want to turn off Play on Awake to keep the audio clip from playing twice within the cutscene. Also, adjust the Volume settings for both VO and Music objects to a reasonable playing sound.
When we play the game and get caught, the Game Over Cutscene plays with the Darren is Caught music playing in the background. Also, we hear Oliver telling Darren “not to worry we will get him out” only once in the scene. The volume of the audio clips you will notice is not too loud, and when the cutscene ends we will hear the Ambient background music still playing.
Next time we will work on the Intro Cutscene music. Happy Thanksgiving to you and your family.