How to sync world props?

Hello,

In unity I have on my scene some few cubes. They have rigidbody and Photonvew. They actually have no owner. But they do not get synchronized between players.
I added rigidbody to observered component and also tried PhotonTransformView. It does not synchronize for some reason.

How do I this exactly.

( Googled this problem but didn't found much and others was old like 2011)

Comments

  • Add photon view to moving object, create script and use OnPhotonSerializeView(PhotonStream stream,PhotonMessageInfo info) method send next your transform.position and rotation. At same time reciveNext() remote messages: private vector3 remotePos = (Vector3)stream.ReciveNext();

    And now in Update Method if(!photonView.IsMine){ transform.pos = remotepos;}
    This will update the current position of this remote player. Same with rotation.
    Save script add it to the photonview object and paste it into photonview as observed component.

    Hope this helping a bit.