How would I sync particles properly?

[PunRPC]
void RPC_ShootParticles()
{
        ParticleSystem muzzleFlash = transform.FindChildRecursive("Fireworks").GetComponent<ParticleSystem>();
        if (muzzleFlash.isPlaying)
        {
            muzzleFlash.Stop();
        }
        muzzleFlash.Play();
}

void Shoot()
{
        PhotonView photonView = GetComponent<PhotonView>();
        if (photonView)
        {
            if (photonView.IsMine)
            {
                photonView.RPC("RPC_ShootParticles", RpcTarget.All);
            }
        }
}

This code above makes everyone's gun shoot. How can I make it that only the shooter's gun shoots, but everyone sees it?

Comments

  • Hi,

    You can pass a reference of the player who is firing, and you simply check if the photonView belong to that player and only fire if that's true.

    Bye,

    Jean
This discussion has been closed.