World Utilities / UI
Toggle Button
A button that flips a boolean value and reflects its state through color and optional on/off labels.
since v0.1.0localsynchronizedpersisted
| Component | Add Component menu / prefab | Source |
|---|---|---|
Value Toggle ButtonVRCTools.World.Values.UI.ValueToggleButton
|
Values › UI › Value Toggle Buttonprefab: Button Toggle.prefab
|
ValueToggleButton.cs ↗ |
Turns a regular Button into an on/off switch. Clicking calls _Toggle(), which flips the bound boolean. The button’s
Image is tinted with the active or inactive color, and - since v0.5.0 - separate On and Off label objects can be
shown depending on the state.
Parameters
| Section | Parameter | Default | Description |
|---|---|---|---|
| Type | LOCAL |
Kind of the bound value. | |
| Source/Target | None | The boolean value. Required. | |
| Appearance | Active Color | white (1, 1, 1, 1) |
Image color while the (possibly inverted) state is true. |
| Inactive Color | gray (0.5, 0.5, 0.5, 1) |
Image color while the state is false. |
|
| Alternate Label | false |
Show On Label / Off Label depending on the state. |
|
| On Label | None | Game object shown while the value is true. |
|
| Off Label | None | Game object shown while the value is false. |
|
| Advanced | Invert | false |
Swap active and inactive colors. |
Requires an Image on the same game object. Wire the button’s On Click to SendCustomEvent("_Toggle").
Functions
| Function | Description |
|---|---|
_Toggle() |
Flips the bound boolean value. |
Invertonly affects the colors. The on/off labels always follow the value itself.