Unity Game Development — Sound Effects in Unity
Having set the background music, I now want to begin adding more sound effects to my game. The first effect that I sorely seem to be missing is the sound of the cannon firing. I will add this AudioClip and a couple of others to begin building my game’s soundscape.
As I mentioned in my previous article, Unity uses an AudioListener Component to detect AudioClips. There can only be one AudioListener in any given scene. However, you can use as many AudioSource Components as you need.
Objective:
Add sound effects to my player’s shooting abilities.
Method:
I will begin by adding an AudioSource to my tank’s turret.
This new AudioSource will play AudioClips as needed. Therefore, I don’t have to assign a clip to it yet.
In my Player Script, I will include the clips I need by adding two fields of Type AudioClip.