World Utilities / UI
UI
Connect Unity UI controls to values - in both directions.
UI components keep a Unity UI control and a value in sync. Interactive controls (toggles, sliders, input fields, the color picker) write to the value when the player uses them and follow the value when something else changes it - so two menus bound to the same value always agree, and a synchronized value updates everybody’s UI.
Use the prefabs
Every UI component ships as a ready-made prefab under Runtime/Prefabs/Local Values/UI and
Runtime/Prefabs/Synchronized Values/UI. Drop one onto a world space canvas, reference your value and you are done.
Building a control yourself? Interactive controls need the Unity UI event wired back to the component, because Udon cannot subscribe to UI events at runtime:
| Control | Unity event | Call |
|---|---|---|
| Toggle | On Value Changed |
UdonBehaviour.SendCustomEvent("_OnValueChanged") |
| Slider | On Value Changed |
UdonBehaviour.SendCustomEvent("_OnValueChanged") |
| TMP Input Field | On Value Changed |
UdonBehaviour.SendCustomEvent("_OnValueChanged") |
| VRC URL Input Field | On Value Changed |
UdonBehaviour.SendCustomEvent("_OnValueChanged") |
| Button (Toggle Button) | On Click |
UdonBehaviour.SendCustomEvent("_Toggle") |
Your canvas needs a
VRC Ui Shapecomponent and must be on a layer players can interact with (e.g.Default), otherwise the controls won’t respond to VRChat’s laser pointer.
- ToggleBinds a Unity UI Toggle (checkbox) to a boolean value.
- Toggle ButtonA button that flips a boolean value and reflects its state through color and optional on/off labels.
- SliderBinds a Unity UI Slider to a float or int value, with optional range mapping.
- LabelsDisplay float, int, string and URL values in TextMeshPro texts using format strings.
- Input FieldsLet players edit string and URL values with text input fields.
- Color PickerA hue/brightness color field players can point at to pick a color.