O'Reilly logo

Unity Game Development Scripting by Kyle D'Aoust

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding all the sounds

Now we will add the background music and atmospheric sounds.

Playing the background music

Create a new empty GameObject and name it Audio_Manager. Drag-and-drop the BG_Music_Manager script on it. For this game, I will only use one song, so set the size of the Song List to 1 and add a song. If the volume isn't already set, set it to 1 as well. Before you can move on, you need to add an Audio Source component to this object. To do this, click on the Add Component button, click on the Audio option, and finally click on the Audio Source option.

Adding the atmospheric sounds

Next, we will add the atmospheric sounds. To do this, we will use a similar process as the background music. Create an empty GameObject and drag-and-drop the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required