Two audio listeners

Because of the way I transition between scenes, I sometimes find that for a split second, there are two audio listeners in the scene, which generates the message “There are 2 audio listeners in the scene. Please ensure there is always exactly one audio listener in the scene.”

This is fine, and I understand why it’s there, except for one thing: it spews out sometimes thousands of those, which makes troubleshooting other things very difficult.

I’ve tried some gymnastics to make sure that there is one and only one audio listener, to do the tightrope between that message and the other one “There are no audio listeners”, which also spews out in the thousands. Such gymnastics just introduce more complexity and don’t always work right.

Collapsing messages in the console sometimes helps, but sometimes I need to see things in the order that they happened, and collapsing makes that harder.

I load my scenes asynchronously and sometimes additively, which, for some reason, asynchronous loading leaves the first scene loaded for a short time while the next gets initialized. Not sure if additive loading has anything to do with it. It’s only for a split second that there are two listeners there, but if I pause the game for troubleshooting, it continues to spew them out, even though it’s not playing.

Is there any way to disable or limit the message about audio listeners? It’s not helping anything in my case.

Unity team: It would be better to have just a single warning message in the console than thousands of info messages. That way it would still stand out, but not flood the console. Maybe an option?

Put the audio lister in another, permanent additive scene then, or as a DontDestroyOnLoad object (which is effectively its own scene).

It’s pretty common to this with things like audio and the EventSystem component as well.

That’s the way I’ve been doing it with my newer projects. To do it that way in this one, I would need to pretty much reconstruct the entire project. The player object is very tightly integrated with the mechanics in each scene. You’re right, of course, but 1) can’t really fix it in this project, and 2) it’s still overkill to spam thousands of identical messages to the console.