Captivating with Sound

Audio really brings a game to life. So let’s immerse ourselves in the world of Unity’s audio options. This article will cover adding background music.

It would make sense to create a game object that will manage our game audio.

  • Right click inside the Hierarchy panel, select “Create Empty”, and rename it “Audio_Manager”.
Create Audio_Manager Game Object

Because this will be my background music, I will create a separate game object to handle this.

  • Right click on “Audio_Manager” in the Hierarchy panel, select “Create Empty”, and rename it “Background”.
  • With “Background” selected in the Hierarchy panel, click on the “Add Component” button in the Inspector panel and find and select the “Audio Source” component.
Creating Background Game Object and Adding Audio Source Component
  • With “Background” selected in the Hierarchy panel, drag your background music asset from your Projects panel and drop it into the “AudioClip” slot in the “Audio Source” component.
  • Because this is the background music, we want it to continually loop throughout gameplay. On the “Audio Source” component, click to add a checkmark for the “Loop” option.
  • “Play on Awake” should already be checked. If not, click to add a checkmark for that parameter.
Adding Background Asset to AudioClip
  • Be sure to save your scene. You can run the game to test that the audio is playing in the background.

Thank you for reading this article. To keep up with my progress on this project, please follow me here on Medium.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
James Hills

James Hills

I am a married father of 5 children. I decided at 13 years of age that I was going to become a Software Developer.