Proper way to synchronize object that has no specific authoritative player?

Hi! Two noob questions (we're using Photon for a VR sandbox universe):

1) What is the proper way to set up an object in the room that everyone can move and place, i.e. where there's no specific authority except during the time its held by the other person? The object would be static in air, non-physical. (For the original placement position of the object, we're using a database, so that's fine during Photon room creation.)

2) What is the proper way as above but for an object that's physical (falls, bounces, can be thrown etc.)?

Thanks!

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    I think whether a networked object is "physical" or not depends on the components attached to the prefab.
    So you need a prefab with at least a PhotonView component put under "Resources" folder.

    1) I think what you are looking for are scene objects instantiated using PhotonNetwork.InstantiateSceneObject. Scene objects always "belong" to the current master client.

    2) I think you just need to add the proper components to the prefab in order to sync. object state like PhotonRigidbodyView or PhotonRigidbody2DView.
  • Thank you very much, looks like SceneObject is what we need then! I have a small follow-up question:

    I would guess SceneObjects automatically sync their rotation, position, scale, maybe node position and name... is that right? But how would we handle for such an object other syncing needs, say we had a component XYZ on that GameObject with the property Foobar = 10, how would we properly synchronize that value to all clients?

    Thanks!
  • JohnTube
    JohnTube ✭✭✭✭✭
    I highly recommend you finish "PUN Basics Tutorial" first.
    Then go through our PUN package demos.

    I would guess SceneObjects automatically sync their rotation, position, scale, maybe node position and name... is that right?
    You would need PhotonTransformView for that.
    But how would we handle for such an object other syncing needs, say we had a component XYZ on that GameObject with the property Foobar = 10, how would we properly synchronize that value to all clients?
    You would need to implement a custom OnPhotonSerializeView.
  • Thank you!