Unity Development — Background Music

We’ve made some gameplay. We’ve add art and animation to polish it up. I believe it is time now to get the blood pumping with some music.

This is going to be a fairly quick lesson. There are complications that can come in from adding audio to your Unity project, but adding background music is the first step and is extremely simple. Of course, you will need to import a musical track of your choosing. It would also be wise to have an ‘Audio’ folder in your Project Window.

In the Hierarchy, make an empty object that will be your Audio Manager. You will most likely use this Audio Manager for jobs other than playing the background music, so let’s also make a child of it, and call it Background or Background Music.

Go to the Inspector of that object and add an Audio Source component. There are a lot of attributes in this component. You can place any track you his in the ‘AudioClip.’ Loop will tell the track to loop repeatedly. Play on Awake will play your track as soon as the scene begins. Other we will touch upon another time.

Drag your track into the ‘AudioClip’ section. Turn or Loop and Play on Awake. Start your Scene and listen to the music play. This will loop repeatedly, so now you have background music for no matter how long the player keeps going.