Two audio listeners warning

I add two cameras into a scene.As each audio listener has a audio listener.So, I add two audio listeners in the scene.The Unity IDE console always gives me the following warnings:
"There are 2 audio listeners in the scene. Please ensure there is always exactly one audio listener in the scene.
"
Why?How to solve it?

1 Like

Remove one of the audio listener components.

I put two cameras in order to switch cameras when playing.So,when switching cameras,should I switch audio listener at the same time?

You can turn off one of the listeners at a time using the enabled property.

1 Like

Thanks! :smile:

where do you find the enabled property to remove it

Its right here in the scripting docs:

Enabled

To turn it off in your script, you could do something like:

Camera.GetComponent(AudioListener).enabled = false;

Thanks Alf203 that helped!

I think it’d be

Camera.GetComponent<AudioListener>.enabled = false;

nowadays. But this didn’t help me, though. I don’t have any audio listeners, and I definitely don’t have them attached to a camera.

Well it doesn’t matter you can use GetComponent with a type instead and that’s actually probably more efficient since the generic version casts the Component as the desired generic type while GetComponent(Type) doesn’t.

If you’re getting the error, it means you have some Audio Listeners in your scene. Try to browse through the hierarchy to find them.

ahhhhh i figured it out if you have 2 different scenes (i have a player AND menu scene) just disable audio listener on all but one of the scenes you have enabled

i’m trying to make a survival game (i’m new btw) and i make import two packages one being the standard unity assets and the other being a texture pack then add a terrian to make my island and then it says i have two audio listeners and now my sound in the game is gone how do i fix this?

First, please don’t reply to 11-year-old posts. Start your own… it’s free.

Second of all, it’s a pretty straightforward error. You managed to get 2 audiolisteners into your scene at once. Fix that by removing one of them. If it happens again, figure out how.

Beyond that, please start your own fresh thread.

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

How to understand errors in general:

https://forum.unity.com/threads/assets-mouselook-cs-29-62-error-cs1003-syntax-error-expected.1039702/#post-6730855

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: https://discussions.unity.com/t/481379