Hey, whenever I start my game I get a pile of messages about having no audio listeners until I start my game. I’m building a multiplayer game so it makes sense for me to just wait and construct the listener when I spawn each player. Is there a way to hide/dampen this message? It seems like it should at least be posted a single time as a warning instead of barfing all over my info log :). Makes it hard to use the info log and I’ve resorted to using the warning log as my info log.
Instead of creating one once your multiplayer game has started, you could just grab the existing one that comes in the empty scene, Destroy it, and add a fresh one to wherever your player listener is located.
Or move it to your player. No need to destroy necessarily.
Not sure if you can actually move a component. In the standard scene setup I mentioned, the AudioListener comes attached to the Main Camera already.
If you made another blank GameObject to hold a different AudioListener, then you could grab that object, parent it to your player, set its localPosition to zero, set its localRotation to Quaternion.identity (otherwise your stereo directional sound will be wrong!), and then it would effectively have been moved.
I prefer to:
Destroy( Camera.main.GetComponent<AudioListener>());
myPlayer.AddComponent<AudioListener>();
Actually, I’d null-check the component before I went to destroy it. ![]()
Yeah, I’ll probably end up doing something like that just to shut the log up. Shame though, cause it feels so much cleaner to do it my current way ![]()