void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { //We own this player: send the others our data networkCulling.SetGroup(photonView); stream.SendNext(mTrans.position); stream.SendNext(mTrans.rotation); } else { //Network player, receive data correctPlayerPos = (Vector3)stream.ReceiveNext(); correctPlayerRot = (Quaternion)stream.ReceiveNext(); } }
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { networkCulling.SetGroup(photonView); Vector3 pos = transform.position; Quaternion rot = transform.rotation; stream.Serialize(ref pos); stream.Serialize(ref rot); } else { Vector3 pos = transform.position; Quaternion rot = transform.rotation; stream.Serialize(ref pos); stream.Serialize(ref rot); SetPositionRotation(pos, rot); //Your own synchronization code (or just directly set the position/rotation for now) } }