Building on our previous project, we are now going to add a sound whenever we fire a gun. Import the audio sound (“Free Weapons Solider Sounds Pack from the Unity Asset Store).Make sure your gun prefab is selected in your scene(fire.mp3) and go to your inspector panel. Go to Add Component> AudioSource. Drag the clip we just imported into the Audio Sources AudioClip value.
Now open up the controllerManager script and add these lines in.
That’s it! Your gun should now play the sound whenever you pull trigger and fire a bullet.