- Home /
Strange Audio Output During Awake()
I updated to Unity 4.2.1f4 a few weeks back. Some of my game levels perform a lot of preparation work within the Awake() function, such as resource pooling of weapons, enemies, explosions, etc. It currently takes 12 seconds for the Awake() to complete.
My problem is that there is a lot of crackling sounds and partial audioclip sounds being output to the speakers while the Awake() is building the scenes. This happens even if I turn off the AudioListener in the scene. It even still happens if I completely remove the AudioListener gameObject, which seems crazy to me.
Has anyone else experienced this or know what may be causing it? None of the previous versions of Unity have given me this problem.
I moved my level preparation work into a coroutine started by the Awake() function in hopes that it'd handle things a little better and stop this audio problem. However the issue was still present.
Just now, I decided to deactivate all the level's prefabs in the Project view. According to Unity's Execution Order page, Awake is called just after an prefab instantiation and if it is not active as a prefab, Awake is not called until it becomes active. So basically I have disabled the enemy, weapon, and explosion prefabs. The audio issue is still somewhat present (perhaps because I've still missed a few prefabs), however the level's load time has dropped from 12 seconds to about 0.5-1.0 seconds. Wow!
Of course that makes sense because the objects and their components aren't all being initialized at once. But what doesn't make sense is that even if all prefabs are active upon instantiation, why without an audio listener their audio components would still output to the speakers.
What you heard might not be actual AudioClips playing. If what you heard was maybe buzzing and crackling (which you mentioned) it could just be the current in the motherboard inducing a current on your sound card, thus producing output. $$anonymous$$aybe you have an issue like this one with sound from a hdd 'leaking' to a sound output.
If what you heard were parts of an actual AudioClip (music... or maybe speech) then it's possible you had PlayOnAwake set to true. Though nothing should be heard if you have no AudioListener in the scene.
Thanks for the reply, Jamora. However it is indeed parts of the actual AudioClips as I recognize both some of the sounds it makes and it also plays very brief (fractions of a second) of my game's music too. I do have PlayOnAwake set for many of the audio clips. But as mentioned, it occurs even with no AudioListener enabled or even in the scene.
$$anonymous$$aybe what you can hear is the audio listener from the previous scene being destroyed?
At this point there is no previous scene so there is no previous audio.
I should point out that this is occurring both in Unity and also in the standalone player as well.
Your answer
Follow this Question
Related Questions
Multiple audio recorders like Audio Listener. 0 Answers
Audio Listener Tiny Unity (Spacialized audio ?) 0 Answers
Pitch changes when i get closer to object with audio source 1 Answer
Make Sound Effects Not Audible Unless Near Them 2d? 1 Answer
Sound volume: How to ignore distance between source and listener? 2 Answers