Owner Button to Respawn Synced Objects

Hi, all!

I have a question that involves making a UI button that, when clicked only by the master of a given instance, will reset all synced objects within a world. This is for my Universe Udon world where objects are strewn about very easily and I was figuring out how to make a master-only button to respawn them.

For context, the main Pickup Button, once clicked, will send a custom event to the Respawn runtime, which is the graph used in question.

This would not work for obvious reasons, but it’s something about IsOwner (not IsInstanceOwner), and sending a network event to update synced objects for all players. Does anyone have an idea on how to set up networking nodes to where the master of an instance can click on the reset button and ONLY the master? I appreciate it!

1 Like

SOLUTION: A friend of mine helped me out with the script using Udon Sharp. It’s something to do with Networking.LocalPlayer.isMaster.

1 Like

For folks tuning in in the future, you’ll want to do the following in your tool of choice:

  1. Have all the synced objects be in an array so you can iterate through them
  2. Have an event that your button is going to call from the UI that, as a first step, checks if the Networking.LocalPlayer.isMaster value is true. If it is, do what you want, like call a SendCustomNetworkEvent like in this video, or use Network.SetOwner to claim the object for the Networking.LocalPlayer before calling VRCObjectSync.Respawn.
1 Like