Learning the basics of Unity audio
At the most basic level, Unity's audio system functions with two components: an audio source and an audio listener. An audio source stores a sound file (known as a clip) and emits a sound at its location in space; the audio listener detects this event and plays the clip through the player's speakers or headphones based on the listener's distance from the source.
The following top-down diagram demonstrates this basic principle:
There should never be more than one audio listener per scene (that would be like having two pairs of ears) but you can spread audio sources all throughout the scene, or add them to existing objects, to create a multi-faceted soundscape for your game's environment.
Note
By default, every Camera object created in Unity comes with an Audio Listener component. That means if you're using an extra camera for something (like our UI raycast implementation) it's important that an Audio Listener component only exists on the camera responsible...