Deserialization fires for all non-owners when a player joins
available in future release
Constapatience
OnDeserialization gets called for all non-owners every time a player joins.
I made this world to demonstrate this. Have two people in the world and then have the master click the cube and the non-owner player will see the count go up. Then have a third player join the world and despite the master/owner not clicking the cube to change the synced variable OnDeserialization gets called again for the non-owners in the world causing the count to go up.
Log In
Phasedragon
available in future release
Well, we've been working on this for a long time now - about 10 months. And I'm happy to say that the update fixing this issue has now been released to open beta! Users joining the instance will no longer cause the owner to resend all their data and get everybody clogged in extreme cases.
Phasedragon
Merged in a post:
Calling RequestSerialization from OnPlayerJoined causes Deserialization to happen twice
Joker is punk
- 2 (or more) players are in an instance
- some value "earlyValue" is already synced on VRC's server
- Player 3 joins
- Owner calls RequestSerialization from OnPlayerJoined
- Owner serializes an updated value, "newValue"
- Remote players deserialize out-of-date "earlyValue" (player 2 is doing this for the second time)
- shortly after, remote players also deserialize "newValue"
If RequestSerialization is called from some other event like Interact, there is no issue.
See attached images. In the screenshot of the debug logs, the relevant messages are in green.
First the Owner calls RequestSerialization from Interact three times, sending the value 19767 the last time. Each time the second player receives the value as expected.
Then a third player joins, and Owner calls RequestSerialization from OnPlayerJoined and sends the value 22531. The second player now deserializes 19767
again
before immediately deserializing the correct value, 22531.Unity package for min repro scene: https://drive.google.com/file/d/1-MdSfw4HrXeEoArW-6wsEHQtlNfXkOQM/view?usp=sharing
Phasedragon
in progress
Technically, this will be improved in a later update that we're working on so I will mark this as in progress. However, I should mention that you should never rely on every serialization to happen exactly once or even for every serialization to happen at all. It is not a messaging system, it is a syncing system. You may receive the same data twice or you might not receive some intermediate values at all. What matters is that everyone is "eventually consistent" and lands on the same value after the dust settles.
You are welcome to add your own logic on top of this to create a messaging system, such as a timestamp to ignore repeated messages or an array of values to queue up and send multiple quick messages at once.
H
HeySora
Having the same issue in a private world I'm working on.. I hope this can get fixed soon