Skip to content

Instantly share code, notes, and snippets.

@Vavassor
Created October 14, 2025 22:18
Show Gist options
  • Select an option

  • Save Vavassor/c326009ba65a5380c417d10341be9fef to your computer and use it in GitHub Desktop.

Select an option

Save Vavassor/c326009ba65a5380c417d10341be9fef to your computer and use it in GitHub Desktop.
VRChat U# Integer Sync Example
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
public class IntSetting : UdonSharpBehaviour
{
[SerializeField, UdonSynced] private int valueSync;
public void SetValue(int newValue)
{
Networking.SetOwner(Networking.LocalPlayer, gameObject);
valueSync = newValue;
RequestSerialization();
ApplyValue();
}
public override void OnDeserialization()
{
ApplyValue();
}
private void ApplyValue()
{
// React to the value changing here!
// Like if the number were a score, you'd update the scoreboard here.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment