In the last section of this chapter, we will introduce another layer of audio with background or theme music. This is an often overlooked layer that can really set the mood of the game or during the progression of a game. In later chapters of this book where we cover adaptive music we will get into detailed examples of altering music during gameplay. For now though, we are going to look at a simple use of scripting to set the looping behavior of some background music we want to use for our scene. Follow the instructions here to add background music to the scene:
- Open up Unity to the Viking Village scene as we last left it. Create an empty GameObject in the scene and rename it BackgroundMusic.
- Locate the viking_music audio clip in the Project window. Drag the clip onto the new BackgroundMusic object in the Hierarchy window. This will automatically add an audio...