Particles syncing on the Unity Network

Hello there, I’ve got a trouble to sync particles in Unity Network system. How can I see it on client when emitting them on host and so on? Any ideas and solution are appreciated please :slight_smile:

I’m going to answer this question for posterity.

Like everything else in Unity, particles wont sync over the network just because you want them to (some “network enabled” components do but they are rare and deprecated with the old UNET). So, when you press “F” to emit your particles, you need to send a signal over the network to tell the “other side” to fire a particle.

In “pseudo code” you have to do something like this:

void EmitParticle() {
    particleSystem.Emit();  // Launch your particle as usual

    If (isOnlineGame) {       // Tell network clients to launch particles

Unfortunatly I can’t be clearer about SendNetworkEventToEmitParticles() cause it changes depending on which multiplayer solution you are using (Unet, Bolt, ForgeNetworking, etc.) and how you implemented it in your game.

On the remote side of the connection you also need to have code in place to receive those network messages, interpret them and then act accordingly. In this case, emit particles (taking care not to send them again on the network or you will end up with an endless loop). This is pretty much the same for everything you want to sync over the network, firing a weapon, changing the weather, loading a map, changing which song is playing, etc.

Also, to be clear, the idea is not to replicate every single particle over the network but only to tell remote entities to fire their particles when needed. ie.: When dealing with bullets you can include in your message extra info like the target that was hit so you can properly “orient” your particle system before firing but beside that don’t try to make it perfect. Remember that a game is all smokes and mirrors and over the network there is A LOT of smoke. FYI in this “bullet” case, synchronized bullets should never apply damage, it is only there for the show. Applying actual damage should be processed locally (like in a single player game) and then you send a damage event over the network.

Implementing multiplayer is one of the most complex part of game development. This is not the time to skip the manual. This is coming form a guy that doesn’t like to RTFM. If you don’t do it all you are doing is wasting your time and will end up rewriting your implementation multiple times before it starts working “semi” correctly and even then you will end up in the manual.

Good luck!

You should have a ParticleSystem on both sides, then If you want to ensure that both sides see the same particle effect set the random seed to be the same (none zero) value on all clients. Unity - Scripting API: ParticleSystem.randomSeed.

Bump anyone? Particles only work when they are set “Play On Awake” but when I want to emit it runtime it doesn’t work so I guess I must emit it wrong. I am using

void Update()

I think it must be a problem but how to do it so that clients can see it?

Hey bro. did you manage to get it work? I am stuck with the same issue.