We will create another
AudioSource to play all sound effects. The way in which we have the sound effect play will be handled through code instead of having it play instantly and continuously.
Now, within the Hierarchy, select Create | Audio | Audio Source. Position it at 0,0,0 and rename it
Sound, as shown in the following screenshot. Since we don't want a sound to play the moment the game starts, deselect Play On Awake. Also drag and drop the
KeepAround.cs script into the Inspector:
I chose to have this single audio source for my sound effects and to have it continue through each scene to make muting and unmuting the sound ...