Persistence

Share us your Persistence bugs and feedback here (one item per post).
Non-constructive and off-topic posts will be moved or deleted.
Adding new UdonSynced fields to a Player Object appears to make saved data read-only / unsyncable / Guideline to add new UdonSynced fields in a VRCEnablePersistence object unclear
Steps to reproduce (TLDR: bold ): Create a world that has this UdonBehaviour(OurTestObject.cs): https://gist.github.com/hai-vr/3439f25571fcc4ad4f65107ad46657d8 Hierarchy example: - Pool - PlayerObject -- VRCPlayerObject + VRCEnablePersistence - OurTestObj -- UdonBehaviour(OurTestObject.cs) - Canvas 5x5 - Text -- TMP_Text 5x5 Alignment=Center&Bottom Wrapping=Disabled Overflow=Overflow In UdonBehaviour(OurTestObj), reference the TMP_Text component Upload the world Start two real clients Make Client A join the world Make Client B join Client A's world Make Client A rejoin the world After Client A finished rejoining the world, Make Client B rejoin the world At this stage, timesJoined should equal to 2 for both clients, confirming that Persistence is working for this world. In OurTestObject.cs, uncomment line 2. This will add a new UdonSynced bool field initialized to false, and a new line in the debug text. Recompile and reupload the world. Make Client A create and join a new instance of that world In Client A's perspective, notice the following in the debug text over the their own head: - The dateTime timer is ticking - timesJoined is equal to 3 - testBool has no text displayed (neither true nor false), but testBool is defined as a bool in U# (testBool appears to be null) Make Client B join Client A's instance In Client B's perspective, notice the following in the debug text over the Client A's head: - The dateTime timer is NOT ticking - timesJoined is equal to 2 (instead of 3) - testBool has no text displayed (neither true nor false), but testBool is defined as a bool in U# - The message "No new data received since ...s" appears, indicating no serialization has occurred. In Client A's perspective, notice the following in the debug text over the Client B's head: - The observations are identical to Client B's of Client A (serialization is failing, so no new data is received) (despite the above, data has been restored to persistent values because timesJoined is greater than 1) (testBool appears to be restored to null from the perspective of other clients, prior to the failed serializations) In Client B, go to the world description and click "Reset User Data", this will make Client B rejoin the world In Client B's perspective, notice the following in the debug text over the their own head: - testBool is equal to false In Client A's perspective, notice the following in the debug text over the Client B's head: - testBool is equal to false - The dateTime timer is ticking (resetting the User Data has correctly set testBool to its expected value of false, so testBool is correctly supposed to be initialized to a non-null value of false) In Client A, rejoin the world. In Client B's perspective, notice the following in the debug text over the Client A's head: - The message "No new data received since ...s" appears, indicating no serialization has occurred. In Client A's perspective, notice the following in the debug text over the their own head: - timesJoined is equal to 3 (despite the Client A having rejoined the world 4 times, the data can no longer be updated. VRChat servers still appear to retain the value of 2 being stored for timesJoined) Observed: Persistent data becomes frozen, unable to be updated any further, and is no longer syncable. UdonSynced fields is contaminated with illegal values (null is never supposed to be in a field of type bool), possibly affecting other Udon program that depend on the integrity of that data. Expected: Persistent data should remain updatable after new fields are introduced to Player Objects. Fields of a certain type should not be contaminated/overriden with illegal values for that type. A clear guideline about adding new fields to Player Objects should be documented officially. According to a VRChat representative on Discord: "in theory it should be just adding udonsynced fields and it's done. There's even metadata that is used to match up an old serialization to a new script to ensure compatibility (and this code has been in use for over a year when two people in the same instance are on different versions of the world). There seems to be some bugs with that system occasionally and it's definitely got room for improvement. Providing a default value rather than straight null would definitely be a good start, and I assume that's 90% of the issues, but it's hard to quantify so I'm not sure exactly what other issues might exist" https://discord.com/channels/189511567539306508/1294086083524432022/1330996987797045320
2
·

tracked

ClientSim doesn't work with Player Objects when Reload Domain disabled
If the Unity project settings Reload Domain is disabled, ClientSim doesn't properly handle Player Objects, causing exceptions and stopping work. Repro Start Unity. Create a scene. Add VRCPlayerObject component(s). Enable Play Mode Options and disable Reload Domain (via Unity menu > Edit > Project Settings > Editor > Enter Play Mode Settings) Press the Play button to start ClientSim (it will work normally at the first launch). And exit play mode. Press the Play button again. Then, MissingReferenceException occurs (see attached). And it doesn't work correctly anymore. Version World SDK 3.7.5 Analysis Clientsim caches the Player Objects in ClientSimNetworkingUtilities._playerObjectList . And it depends on the reloading to initialize it. It should be initialized when starting the simulation. Snipping from the log for searching MissingReferenceException: The object of type 'VRCPlayerObject' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object. VRC.SDK3.ClientSim.ClientSimPlayer.SetupPlayerPersistence (VRC.SDK3.ClientSim.IClientSimEventDispatcher eventDispatcher, VRC.SDK3.ClientSim.IClientSimUdonEventSender udonEventSender, VRC.SDK3.ClientSim.IClientSimBlacklistManager blacklistManager, VRC.SDK3.ClientSim.IClientSimUdonManager udonManager, VRC.SDK3.ClientSim.IClientSimSyncedObjectManager syncedObjectManager, VRC.SDK3.ClientSim.IClientSimPlayerManager playerManager) (at ./Packages/com.vrchat.worlds/Integrations/ClientSim/Runtime/Player/ClientSimPlayer.cs:198)
1
·

tracked

Load More