# Audio listener

The audio listener AudioListener will receive the audio input from Audio Source AudioSource or AudioMixer in the scene and play the sound through the computer speakers. For most game scenes, it makes the most sense to attach the monitor to the main camera.


# Attributes

AudioListener has no attributes, but AudioListener must be added and active is set to true before the sound emitted by AudioSource can be heard.


# Sound component

You can add [sound effect component] (./audioEffectComponent.md) to the node where the AudioListener is located to make the sound effect work on all audible sounds. The order of the sound effect components is important. As shown in the figure below: The sound from AudioSource or AudioMixer will be processed by AudioEcho and then processed by AudioDistortion before being received by AudioListener.


# Notice

  • By default, the orientation of the node is (0, 0, 1), and the upward direction is (0, 1, 0). Therefore, when adding AudioListener to a newly created node, the orientation of AudioListener is (0, 0, 1) and the upward direction is (0, 1, 0).
  • Each game scene can only have one AudioListener that is active (active=true). When there are multiple AudioListeners with active=true, the last one that is activated (onEnable is called) is a valid audio listener.
  • AudioListener and AudioSource cannot be added to the same node at the same time, otherwise the sound effect components on the node may work abnormally.