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
\$\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\$
  • \$\begingroup\$ So, this simply transform a normal method in a "networked" Photon RPC method ? Thanks ! \$\endgroup\$ – stighy May 6 '16 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.