Syncing ParticleEffects

I just started working with PUN free, I've followed the basics tutorial and everything is going well for my online 2D platformer.
I'm not new to Unity or C#, been doing it for several years now.
But I am brand new to PUN, so very newbish in that respect.

I want to use particle effects as a ranged weapon for my characters.
I have everything working well client side, but am having trouble trying to get the particle effects to sync online.

I have a particle effect that shoots a one particle burst.
It has collisions enabled.
I have a script attached to the particle system gameObject that uses the OnParticleCollision() method to detect collisions and applies damage.

It all works fine for the local client side. The particle shoots out when I hit the key, and damages enemies or other players.
Their health gets synced properly and everything.

But I wasn't sure how to sync the particle effect.

So I thought I could try and just sync a boolean variable
bool isFiring;
so that everyone would know if isFiring is true.
and if it was then fire the particle system, whether it's on owner or another client.
then just set that to false again.

So I have a script
on the main gameObject of my Player that inherits the IPunObservable interface.
and in the PhotonViewer component I have this script added to the Observed Components.
(Script included at the bottom.)

This method seemed to work fine for the health script, which updates health float and world canvas health slider properly for all clients.
I think i'm just missing something for this.

I have another script
that handles keyboard input and will call the below script's public Fire() method when you press the fire key.

Anyways, I have it checking in Update() if isFiring == true;
if so, it plays the particle and resets the bool.

What I'm going for is to have the local client particle system to do the real damage.
I want to just set the damage value to 0 if we're not the owner.
and if we're not the owner, I still want it to shoot the particle so all can see it, but it's just for show really.

I just don't know how to get the particle system to play for the other player in the room.

Any help would be appreciated! :)
public class RangedControl : MonoBehaviourPunCallbacks, IPunObservable
        private ParticleSystem particles;

        public bool isFiring = false;

        private void Update ()
            if (isFiring)
                isFiring = false;

        public void Fire ()
            isFiring = true;

        #region IPunObservable implementation

        public void OnPhotonSerializeView (PhotonStream stream, PhotonMessageInfo info)
            if (stream.IsWriting)
                isFiring = (bool)stream.ReceiveNext();

Sign In or Register to comment.