Version: 2020.1
Audio Clip
Audio Source

Audio Listener

Switch to Scripting

The Audio Listener acts as a microphone-like device. It receives input from any given Audio SourceA component which plays back an Audio Clip in the scene to an audio listener or through an audio mixer. More info
See in Glossary
in the sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
and plays sounds through the computer speakers. For most applications it makes the most sense to attach the listener to the Main CameraA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
See in Glossary
. If an audio listener is within the boundaries of a Reverb Zone reverberation is applied to all audible sounds in the scene. Furthermore, Audio EffectsAny effect that can modify the output of Audio Mixer components, such as filtering frequency ranges of a sound or applying reverb. More info
See in Glossary
can be applied to the listener and it will be applied to all audible sounds in the scene.

Properties

The Audio Listener has no properties. It simply must be added to work. It is always added to the Main Camera by default.

Details

The Audio Listener works in conjunction with Audio Sources, allowing you to create the aural experience for your games. When the Audio Listener is attached to a GameObjectThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary
in your scene, any Sources that are close enough to the Listener will be picked up and output to the computer’s speakers. Each scene can only have 1 Audio Listener to work properly.

If the Sources are 3D (see import settings in Audio ClipA container for audio data in Unity. Unity supports mono, stereo and multichannel audio assets (up to eight channels). Unity can import .aif, .wav, .mp3, and .ogg audio file format, and .xm, .mod, .it, and .s3m tracker module formats. More info
See in Glossary
), the Listener will emulate position, velocity and orientation of the sound in the 3D world (You can tweak attenuation and 3D/2D behavior in great detail in Audio Source) . 2D will ignore any 3D processing. For example, if your character walks off a street into a night club, the night club’s music should probably be 2D, while the individual voices of characters in the club should be mono with their realistic positioning being handled by Unity.

You should attach the Audio Listener to either the Main Camera or to the GameObject that represents the player. Try both to find what suits your game best.

Hints

  • Each scene can only have one Audio Listener.
  • You access the Project-wide Audio settings using the Audio window (main menu: Edit > Project Settings, then select the Audio category).
  • View the Audio Clip Component page for more information about Mono vs Stereo sounds.
Audio Clip
Audio Source
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961