2
\$\begingroup\$

I'm using Photon to develop a multiplayer game. I would like to know the best way to synchronize "weapons" bullets object between network players. Thanks

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

You don't need to continuosly sync the position of your bullets, you only need to know when and where a bullet was fired. This should be fine for most cases:

[PunRPC]
private void Fire(Vector3 pos, Vector3 dir)
{
    Instantiate(Resources.Load("Bullet"), pos, dir);

    if(this.photonView.isMine)
    {
        this.photonView.RPC("Fire", PhotonTargets.OthersBuffered, pos, dir);
    }
}
\$\endgroup\$
1
  • \$\begingroup\$ So, this simply transform a normal method in a "networked" Photon RPC method ? Thanks ! \$\endgroup\$
    – stighy
    Commented May 6, 2016 at 15:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .