Is it supposed for the synced variables to be synced when RequestSerialization
is called in OnOwnershipRequest
before it returns true
?
i.e., Will OnOwnershipTransferred
be called after the next Network Tick?
Is it supposed for the synced variables to be synced when RequestSerialization
is called in OnOwnershipRequest
before it returns true
?
i.e., Will OnOwnershipTransferred
be called after the next Network Tick?
Hi, @nuip ! Thank you for posting!
Would you mind providing additional context? Have you been testing ownership transfers and observed something you didn’t expect?
No, I’m still designing how to sync the data.
I want to sync an array, but I don’t want to RequestSerialization
every time the array is updated because it’s large. Then I noticed that it would be sufficient to sync it on ownership transfer in my case, and that raised the concern mentioned above.
Cool! Thanks for clarifying.
The intent of OnOwnershipRequest
is just to allow or deny ownership transfers. I don’t think there’s a spec for how it should behave when changing synced variables during the transfer.
It might work! I would suggest trying it out. If it turns out to be very useful behaviour, perhaps we should add it to Udon’s specifications
I would try it if we knew that the result would always be the same. However, I suspect it may depend on various conditions (VRC build version, the number of people in the instance, world performance, etc.) and could cause a bug that is hard to reproduce.
Let me consider other ways.
you can’t avoid RequestSerialization for the array your attempting. no matter what you do it will sync everything everytime that has a UdonSync tag.
and OnOwnershipRequest as mentioned before is to have someone request ownership change. and also OnOwnershipTransferred happens for every user in that world. thus you need to check who the new owner is. but then again you shouldn’t do a RequestSerialize on someone getting ownership.