- Home /
Is there a way to find all the Audiolistener's in a scene?
I have placed an audio listener on an object and now can't find it.
I have removed all AudioListeners on the cameras.
is there a search or script i can run to give me a print out of the Audio listeners in the scene?
Answer by Seth-Bergman · Nov 08, 2012 at 07:36 AM
http://docs.unity3d.com/Documentation/ScriptReference/Object.FindObjectsOfType.html
you can say:
function Start () {
var myListeners : AudioListener[] = FindObjectsOfType(AudioListener) as AudioListener[];
for (var hidden : AudioListener in myListeners) {
Debug.Log("Found: " + hidden.gameObject);
}
}
You can even do better:
Debug.Log("Found: " + hidden.gameObject, hidden.gameObject);
This way, by double-clicking the log you can reach the GameObject.
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