How to Sync with Udon

Was looking a bit into limits of how many synced variables can be used before things break. thought I should share this to help other people looking into this. photon documentation on how many bytes are used for synced variables. https://doc.photonengine.com/en-us/pun/current/reference/serialization-in-photon

Only the network owner of an object can set a synced variable

What happens if a non-network-owner tries to to set the value of a variable? It seems like it would be one of the following:

  1. Nothing happens
  2. The value changes only locally for that object until OnDeserialization
  3. Something else?

something else. Values get set back to the default on update, not ondeserialization. Iā€™m not sure how the update order works out, but if a non-owner sets a synced variable then immediately uses it, they will see the value that they set. But if they set the variable then wait until next frame it will be turned back to the synced value.

For that reason, if Iā€™m doing anything that requires non-owners to manipulate the synced variables, I keep a local copy of it and duplicate it ondeserialization, which will make it behave like your scenario number 2.

Aha! That explains some things. Thank you so much for the info!