I can drag and drop files into the networking example, and when I join from a browser that wasnāt there when the files were created it will load files that were previously created correctly. All very cool.
But how do I delete files that were stored in tiny storage when I donāt want them anymore? Once they are uploaded I get a callback in beginListenFilespawn engine_networking_files and they get added to the scene right away.
Original Post on Discord
by user 563549194137239552
Answering my own question does it have something to do with āsyncdestroyā ?
by user 563549194137239552
SyncDestroy is used for networking the destroy call on a object in the scene - it will not delete data on the backend server.
You can send an event for removing the file upload event so you will not download the file again when you come back to the room later - but I think thereās no code in engine right now for letting the backend know that you want to delete a file completely
I think the backend has code for it - but I need to check
For removing the event from the backend you can use this.context.connection.sendDeleteRemoteState(<guid>)
with the guid of the object that is being spawned. Thatās not ideal but maybe works for the short term?
Iāll try it⦠I have syncDestroy working and it deletes for all clients but when they reload the files come back in from the back end⦠will let you know how the remote state deletion works
by user 563549194137239552
sendDeleteRemoteStateAll works but sendDeleteRemoteState didnāt⦠maybe I am getting the wrong GUID? I used let guid = (found.object as GameObject).guid ⦠itās the same found.object I used syncDestroy on and the syncdestroy seemed to work
by user 563549194137239552
maybe the object i found using raycasting is the child mesh and itās the parent object that is in the remote state⦠will explore
by user 563549194137239552
having trouble figuring out the GUID to use to delete⦠in beginListenFileSpawn if I log the GUID of the gltf file after loading it is different every time⦠should i be using the evt.file_hash that is coming in before the file gets loaded?
by user 563549194137239552
basically i am getting the object to delete by doing a raycast⦠syncDelet works when i call it on that object⦠how do i get the GUID to use for the sendDeleteRemoteState call
by user 563549194137239552
Have you tried deleting the guid that you get via context.connection.beginListen(File_Event.File_Spawned, async (evt: FileSpawnModel) => {
(evt.guid)
Iāll try that
by user 563549194137239552
I hardcoded a GUID from a console.log of the evt.guid and it works⦠now I just need to figure out how to preserve that info ⦠looking at the userData field perhaps
by user 563549194137239552
is there any reason in the beginListenFileSpawn method in engine_networking_files.ts file I canāt just set the objects uuid after being created to the evt.guid from the file spawned event? it should be unique right?
by user 563549194137239552
I think that should be no problem - not 100% sure tho. I dont think we use the uuid that threejs generates anywhere
I just added obj.userData[āremote_guidā] = evt.guid
to it and Iām happy with that
by user 563549194137239552
when i set the uuid to evt.guid it made it not show up on other peoples machine so i will leave that alone
by user 563549194137239552