How to dynamically add a SyncedTransform to a loaded object

I am dynamically loading objects using a custom DropListener and a listenForDrops event. I am getting the drop events and loading objects succesfully.

I am adding the Deleteable, DragControls and SyncedTransform components to try to make the loaded objects behave like the objects in the sandbox sample.

The Deleteable and DragControls components seem to work as expected, but the SyncedTransform component does not.

The objects only get added to the instance where they were dragged in from.

Is there a specific way to add networked synched objects, or something I need to do to add a SyncedTransform and get my object to show up in all instances?

listenForDrops(evt : any)
    // clear all children, re-add the new one

    var gltf : GLTF = evt.detail;
    console.log("Got a DROP EVT: " +;
    GameObject.addNewComponent(gltf.scene, Deletable)
    GameObject.addNewComponent(gltf.scene, SyncedTransform)
    GameObject.addNewComponent(gltf.scene, DragControls)

Original Post on Discord

by user 563549194137239552

It doesnt work because you need to synchronize the guid between the synced transform components that you add between all clients.

The original filespawn has a seed that gets synchronized between all clients. We previously had a code path that added SyncedTransform components etc based on that seed - that code path is currently disabled tho. But you could use e.g. the name + bytesize of the dropped object to generate a somewhat stable seed between all clients and then set the guid of the components using a UIDProvider.

You can look at the code in engine_networking_files_default_components.ts for an example which is the code path i metioned that is currently disabled

I’ll take a look

by user 563549194137239552

For testing purposes i just manually specified a seed here, but it is not syncing with another instance…

by user 563549194137239552

//GameObject.addNewComponent(gltf.scene, SyncedTransform)
const st = GameObject.addNewComponent(gltf.scene, SyncedTransform, false);
var seed: number = 4942345;
const prov = new InstantiateIdProvider(seed);
st.guid = prov.generateUUID();
//st.autoOwnership = true;


by user 563549194137239552

there is no autoOwnership member in the st object

by user 563549194137239552

The dropped object does show up on all instances and the above code is run on all clients?

I should ask… what is the ‘backend url’ member of the dopr listener? Do i need to implement a function that handles drops and sends the file to other clients or something?

by user 563549194137239552

no… the dropped object only shows up in the original instance

by user 563549194137239552

You need a SyncedRoom component and need to be connected to a room. You can check that via the browser console.

there is a synched room component in the scene… it is the sandbox scene i started with and the other objects synch etc

by user 563549194137239552

i am in a room on both computers… the other objects in the scene… the static object synch across both

by user 563549194137239552

just verified that both machines are in the same room and that the original objects in the static scene do synch

by user 563549194137239552

To which backend are you connected?

How big is the model that you’re dropping?

Does the console contain any logs when you drop it?

I’m oinly getting the drop event on the original computer where the drop hqppened… the other machine does not get the drop event

by user 563549194137239552

I didn’t specify a backend

by user 563549194137239552

the model is tiny… it’s one of the models that are already in the scene… catus.glb

by user 563549194137239552

im checking. The droplistener had some fields to fill out for providing a file server for local dev and for production.