- Home /
Audio Listeners?
Hey guys,
In my error console, it says that I have 3 Audio Listeners, and I have no idea what on earth this means.
It says to ensure that there is always only one in the scene....? I'm sure you know what I'm talking about....
Can someone please tell me how to fix this....
thanks
-Grady
Answer by GuyTidhar · Jul 02, 2011 at 08:00 AM
This means you have more then one component in your scene which is responsible for receiving sounds played within the scene.
You might have a few cameras which by default come with an AudioListener component.
You should make sure only one of them is active at a time, so if you switch cameras disable the component (or the whole gameObject) before switching to a new camera and enable the one on the switched to camera.
You might also just keep 1 AudioListener in advance in your scene on a whole different gameObject and remove the rest.
To find all your AudioListener components in your scene go to the hierarchy window's search field, click the little arrow to the left of it, select "Type", and then write in the serah box: "Audiolistener". Now your search will show you all game objects that have AudioListeners on them. Don't forget to select "ALL" again in the search box after you are done...
$$anonymous$$y says Unable to open Assests/Standart Assests/Terrain Assests, or whatever it is... If your a pro, please help
I appear to only have the "Type" option under Projects not Hierarchy is that a pro only feature?
nvm found it but it doesn't work comes up empty when you search by type. oh well guess ill just look at everything one by one because I know none of my cameras have audiolistener but my main.
Answer by ravin5432 · Oct 25, 2017 at 12:51 AM
I only have one camera, Iv checked all 5 of the game obj in the scene, and cant find the other audio listener. I think its a bug. I was just working with the GUI on a new scene, when out of nowhere the error popped up for a 2nd audio listener. It would be nice if there was a way to search for it.
I wasn't able to search for the audio sources, but they were attached to the cameras and I needed to unmark them in order to listen to an actual sound source.
I could easily find them on the Inspector tab though.
Answer by save · Jul 02, 2011 at 08:21 AM
Audio Listeners is the ears of your player and is found on each camera. You probably have three cameras, the trick is to disable each camera and corresponding Audio Listener except the one you want to use when you switch between them.
I whipped up a script for you which is ready to go, just attach it to your main camera (or any other object which is enabled for the whole scene):
var cameras : Camera[]; //Attach your cameras in the Inspector to this variable array
private var currentCamera : int = 0;
function Start () {
switchCameras(false);
}
function Update () {
//Switch camera when user press "C"
if (Input.GetKeyDown(KeyCode.C)) {
switchCameras(true);
}
}
//The function either resets the cameras or switch
function switchCameras (switchCam : boolean) {
if(currentCamera+1<cameras.Length && switchCam) {
currentCamera++;
} else {
currentCamera = 0;
}
for (camera in cameras) {
camera.enabled = false;
camera.GetComponent(AudioListener).enabled = false;
}
cameras[currentCamera].enabled = true;
cameras[currentCamera].GetComponent(AudioListener).enabled = true;
}
This is of course if you have different angles for a player (for instance exterior, interior and rear view of a car).
Your answer
Follow this Question
Related Questions
Getting Unity to listen to desktop audio 2 Answers
Volume rolloff: Distance to listener not changing. 3 Answers
Is it possible to raise an audio sources pitch as an audio listener gets closer? 5 Answers
Having a problem with Audio Reverb Zones. 0 Answers
Music goes crazy on rotating camera? 1 Answer