[SOLVED] How do you Sync Moving GameObjects in the Scene?

Options
AaronFrost
edited December 2019 in Photon Bolt
In my scene, there are moving GameObjects like elevators(that move on an animation), and blocks(that can be pushed by the player) that move in the scene.


I want these objects' positions to always be the same between clients and the server.


To no avail,
I added the Bolt Entity component to these objects.
I created a state called DynamicObjectState and added this to each of the Bolt Entity Components.
I added this script to each GameObject:


using UnityEngine;

public class SyncedObject : Bolt.EntityBehaviour<IDynamicObjectState>
{
    public override void Attached()
    {
        state.SetTransforms(state.DynamicObjectTransform, transform);
    }


}



It also seems that the player's positions aren't exactly synced!

Ultimately, I just want the positions of these moving objects to be the same so players can share an experiencee. Do I need to implement server authoritative movement to all objects?

Please help! Thank you.

Comments

  • stanchion
    Options
    Possible you're doing something wrong with local/global position. Impossible to say more without more details
  • I figured it out.

    The first solution was that all game objects that I want in the scene have to be prefabs.

    They can be in the scene, but they have to be prefab instances.

    The second problem was that I never pressed Bolt - > generate scene object IDs.

    Doing those two got everything synced.