An error occurs in ClientSim when a synced VRCUrl variable is null in a PlayerObject with Persistence enabled.
kurotori
VRCSDK 3.7.5
Steps to Reproduce:
- Attach the VRC Enable Persistence component and VRC Player Object component to an object.
- Attach the following UdonSharp script to the same object.
- Execute Interact() in ClientSim.
---
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
public class VRCURLPersistenceTest : UdonSharpBehaviour
{
[UdonSynced]
private VRCUrl testUrl;
public override void Interact()
{
RequestSerialization();
}
}
---
Observed Error:
When running the script in ClientSim, the following NullReferenceException occurs:
---
NullReferenceException: Object reference not set to an instance of an object
VRC.SDK3.ClientSim.Editor.VisualElements.Fields.FieldFactory.GenerateField[T] (System.String fieldName, T data) (at ./Packages/com.vrchat.worlds/Integrations/ClientSim/Editor/VisualElements/Fields/FieldFactory.cs:79)
VRC.SDK3.ClientSim.Editor.VisualElements.EncodeDecodeEditors.ClientSimUdonEncodeDecodeEditor.GenerateFields (UnityEngine.MonoBehaviour component, VRC.SDK3.Data.DataDictionary data) (at ./Packages/com.vrchat.worlds/Integrations/ClientSim/Editor/VisualElements/EncodeDecodeEditors/ClientSimUdonEncodeDecodeEditor.cs:30)
VRC.SDK3.ClientSim.Editor.VisualElements.ClientSimNetworkHolderInstanceElement.GenerateDataElements (System.Int32 index) (at ./Packages/com.vrchat.worlds/Integrations/ClientSim/Editor/VisualElements/ClientSimNetworkHolderInstanceElement.cs:72)
VRC.SDK3.ClientSim.Editor.VisualElements.ClientSimNetworkHolderInstanceElement.UpdateData (VRC.SDK3.ClientSim.Editor.ClientSimPlayerObjectWindow+PlayerObjectData data) (at ./Packages/com.vrchat.worlds/Integrations/ClientSim/Editor/VisualElements/ClientSimNetworkHolderInstanceElement.cs:94)
VRC.SDK3.ClientSim.Editor.ClientSimPlayerObjectWindow.UpdateCurrentPage (VRC.SDK3.ClientSim.ClientSimOnPlayerObjectUpdateEndedEvent e) (at ./Packages/com.vrchat.worlds/Integrations/ClientSim/Editor/Windows/ClientSimPlayerObjectWindow.cs:259)
VRC.SDK3.ClientSim.ClientSimEventDispatcher.SendEvent[T] (T clientSimEvent) (at ./Packages/com.vrchat.worlds/Integrations/ClientSim/Runtime/Events/ClientSimEventDispatcher.cs:62)
VRC.SDK3.ClientSim.Persistence.ClientSimPlayerObjectStorage.LateUpdate () (at ./Packages/com.vrchat.worlds/Integrations/ClientSim/Runtime/Player/PlayerPersistence/ClientSimPlayerObjectStorage.cs:172)
---
Workaround:
Setting an initial value for the synced VRCUrl variable prevents the error:
---
[UdonSynced]
private VRCUrl testUrl = VRCUrl.Empty;
---
Possible Cause & Suggestion:
It seems that ClientSim does not handle null values properly when processing synced variables. Adding proper null handling for synced variables, especially for VRCUrl, may help prevent this error.
Log In
CompuGeniusCode