Building an immersive soundscape with music, SFX, and ambiance
We’ll cover writing audio player components for what I consider the most common scenarios for the type of game audio we’ll need. We’ll have components for playing music, SFX, and ambient sounds. We’ll also cover playing the sound in 2D or 3D space, as required or desired, for each type of audio player component.
Everything that plays sound in Unity requires an AudioSource
component (think of it as a speaker, and you can have many), and the scene requires a single AudioListener
(think of it as the microphone). By default, our main camera in the scene comes with the AudioListener
component already added – so we’re good; there is nothing further to do there.
Additional reading | Unity documentation
You can read more about the Audio Listener here: https://docs.unity3d.com/2022.3/Documentation/Manual/class-AudioListener.html.
As seen in the AudioManager
implementation, it...