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
1 Answer
\$\begingroup\$
\$\endgroup\$
1
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);
}
}
-
\$\begingroup\$ So, this simply transform a normal method in a "networked" Photon RPC method ? Thanks ! \$\endgroup\$– stighyCommented May 6, 2016 at 15:00