To The Sound — Audio Makes the Experience!

Jack Leavey
3 min readJun 8, 2022


Let’s take a look at the current build:

It plays decently, but the lack of audio keeps the player from really engaging with the medium.

So how do we add sounds in Unity? It’s really very simple!

To add a looping background track that plays when the game starts and plays indefinitely, we can do the following:

  1. Create an empty gameobject to hold an Audiosource component. In my case, I just added an Audiosource to my background gameobject.
The audiosource component.

2. Now, drag whatever sound you want to loop into the “AudioClip” slot.

Make sure Play on Awake and Loop are checked!

Now you have background music!

For any other sound effect (shooting, collecting a powerup, shooting a gun), there is a simple implementation that you can further edit to fit your needs. I will show how I implemented the laser firing sound.

  1. Add an AudioSource to the gameobject you want the sound to come from. I put it on my Player.
A new AudioSource.

2. Go into the C# script associated with the gameobject and add two new variables:

The Audioclip should be named something relevant to the sound you want it to make.

3. Use GetComponent to set your AudioSource variable.

4. Use the AudioSource.PlayClipAtPoint to play your sound effect. This line of code should go in whatever function you want to start your sound effect.

In my case, I want the sound effect to play when the player fires a laser.

Lines 85 and 92 call the sound file to play.

Lastly, don’t forget to place the audioclip into your inspector slot!

Hear the difference!



Jack Leavey

I am a software engineer with years of experience branching into game development, specifically in Unity. Follow along for guides on creating game mechanics!

Recommended from Medium