- Home /
how to switch the audio listeners
Hello, guys. Im from russia, and im is noob in Unity. I have problem. I dont how to switch the audio listeners. I need to audiolistener FPC switched off when player dies, and audiolistener other camera switched on. Help please. And sorry for my English.
Answer by robertbu · May 28, 2013 at 03:03 PM
If you know the name of the two objects that have the audio listeners, you can do:
var go = GameObject.Find("Main Camera");
var al = GetComponent(AudioListener);
al.enabled = false;
Where "Main Camera" is the name of the game object with the listener, and "al.enabled" can be set to true or false depending on whether you are turning the listener on or off.
Your answer
Follow this Question
Related Questions
Numerous simultaneous audio clips getting cut off 3 Answers
Audio not playing well on AudioListener move 1 Answer
Make Sound Effects Not Audible Unless Near Them 2d? 1 Answer
Determine If player Is Shouting into microphone 1 Answer
How to record the AudioListener without it playing the microphone on the speakers? 1 Answer