Playing Sound Effects With Unity

Rook Sullivan
Jun 7, 2021

Sound effects are a huge part of bringing a game together. They give an audio cue that tells the player something has happened. Everything from collecting coins in Super Mario, to firing a gun in Call of Duty has a sound effect.

Unity makes implementing sound effects quite easy! First, you need a game object to hold the sound effect you want to play. Once you have assigned the appropriate sound to it, you can then using scripting to tell your game when to play the sound effect. Using the AudioSource Class, you can create a variable to use AudioSource.Play() to play your sound effect at specific times.

In my game, I have set up sound effects for when a laser is fired, something explodes, and when a powerup is collected.

--

--

Rook Sullivan

Non-binary game dev sharing my experiences in Unity.