Up until now, our game has been silent, but sound is an important factor in any game. In this section, we will be introducing our first sound component. We will make a start by creating sound effects for when our player fires a bullet.
Feel free to add your own type of bullet sound if you wish. You can add sound to your player's standard bullets as follows:
- In the Unity editor, navigate to the Project window and create a new folder inside the Resources folder. Name the new folder Sound.
- Drag and drop the Player_Bullet prefab from the Project panel into the Hierarchy panel.
- With Player_Bullet still selected, click on the Add Component button in the Inspector panel.
- In its dropdown, start typing (and select) Audio Source.
- Drag and drop the PlayerLaser.mp3 file into the AudioClip section of the Audio Source component. The following screenshot shows Player_Bullet selected...