- Home /
Is there a magical AudioListener in game?
A. Create a new project.
B. Place a new GameObject attached an AudioSource component, and place audio clip (MP3 or other). Confirm the "Play on Awake" checked.
C. Run the project in editor. So I can listen the audio, because there was an AudioListener on the Main Camera.
D. Stop, and remove the AudioListener component from Main Camera. Run again, I cannot listen the audio now, because there are not any AudioListener in this scene.
E. Build the project with "PC Standalone" (or Web Player), and run the .exe ... Ooops, I listen the audio now !! Is there a magical AudioListener add in scene automatic ?
I written some C# code check it:
Object[] array = Object.FindObjectsOfType(typeof(AudioListener));
if (array != null && array.Length > 0) {
Debug.Log(string.Format("There are {0} listeners", array.Length));
} else {
Debug.Log("No listener in game");
}
...
No listener, but I can listen the audio.
Have you checked your log on the build or in editor?
Unity might be creating an audio listener when building because it recognizes that you have an audio without a listener.
If the log was in build and showed no listeners, then you might want to report a bug :)
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Audio not playing well on AudioListener move 1 Answer
Sounds appear on wrong side. 0 Answers
Is There A way For unity to Determine If Audio Was Recorded Backwards 1 Answer
Fade in AudioLister over time #c 1 Answer