The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

How am I able to sync particles from my gun with other clients?

LeNerd
2017-01-04 17:04:42

First of all sorry for my bad english.

I programmed a multiplayer game with photon in which you can shoot with a gun. With the help of tutorials I was able to sync the tranformation and rotation with the other clients. I also can shoot them, so they can die. My only problem is, that when I shoot with my gun only I can see the partical effects and the impact prefab. Now to my question. Can someone explain what I have to do, to sync the partical effects of my gun with the other clients.

Here is the shooting script of my weapon

//
//
//PLS READ MY COMMENTS

using UnityEngine;
using System.Collections;

public class Shoothing : MonoBehaviour
{

}

Comments

[Deleted User]
2017-01-05 09:19:35

Hi @LeNerd,

muzzleFlash.Play(); is only called on your local client. You need to synchronize this as well to tell others to play the effect, too. In addition you should add if (PhotonNetwork.isMine) condition to the Update functions to avoid running code on objects that are owned and controlled by other clients.

The PUN Basics Tutorial has some words on shooting in games, too. Maybe you want to check this as well.

Tobias
2017-01-05 09:48:12

I hope that's clear: Call muzzleFlash.Play() when you get shot (for the remote character/weapon which is shooting). Don't send another RPC to do only this...

Pav
2017-01-05 16:32:36

@Christian_Simon Would you also do Photon.IsMine for health update PunRPC?

Back to top