Mirror and audiosources (shooting)

Hi all,

Quick question. I have a multiplayer FPS game everything works (so far). There is one thing however I cant figure out. When a player shoots he hears a shooting sound. Only thing is the other clients don’t hear it. How can I make it so the audio plays on all clients so they hear each other shooting. I googled a bit but can’t find anything that helps me. Who can point me in the right direction?

1 Like

Sorry for the necro… You ever figure this out? I’m having the same problem and the Mirror documentation mentions nothing about audio

There multiple ways, for example when calling the shoot method, just add a network call (client, server…) inside that is “PlayShootAudio” so the other clients will reproduce the sound because of the network call. Other option is to use the shoot method itself.

As a rule remember that a client doesn’t know anything about the server or other clients if they are not “notified” about it. For example, when using synchronized elements is just a shortcut that will “notifiy” others without you worrying about it.

1 Like

It depends on how your bullets work. If you have a visual representation of the bullet, like a bullet prefab you spawn across all clients already, you could consider just attaching the sound to that object. If you don’t, but you have a muzzle flash object, that also makes a good candidate.

1 Like