World Utilities / Values

Presets

Write a fixed value into a local or synchronized value at the press of a button.

since v0.2.0localsynchronizedpersisted
Component Add Component menu / prefab Source
Color PresetVRCTools.World.Values.Presets.ColorPreset Values › Presets › Color Presetprefab: Color Preset.prefab ColorPreset.cs ↗
Float PresetVRCTools.World.Values.Presets.FloatPreset Values › Presets › Float Presetprefab: Float Preset.prefab FloatPreset.cs ↗
Int PresetVRCTools.World.Values.Presets.IntPreset Values › Presets › Int Presetprefab: Int Preset.prefab IntPreset.cs ↗
String PresetVRCTools.World.Values.Presets.StringPreset Values › Presets › String Presetprefab: String Preset.prefab StringPreset.cs ↗
URL PresetVRCTools.World.Values.Presets.UrlPreset Values › Presets › URL Presetprefab: URL Preset.prefab UrlPreset.cs ↗
Vector3 PresetVRCTools.World.Values.Presets.Vector3Preset Values › Presets › Vector3 Presetprefab: Vector3 Preset.prefab Vector3Preset.cs ↗

A preset stores one fixed value and writes it into a target value whenever _Apply() is called. Use presets for “pick a theme” buttons, quick-select volume levels, predefined announcement texts or a list of known image URLs.

Presets exist for every value type that has a meaningful constant: Color, Float, Int, String, URL and Vector3. Boolean values don’t need one - call _SetTrue() / _SetFalse() on the value directly.

Parameters

Parameter Default Description
Type LOCAL Kind of the target value: LOCAL (also accepts persisted values) or SYNCHRONIZED.
Target None The value to write to.
Preset type default (0, "", …) The value that is written when the preset is applied.

Functions

Function Description
_Apply() Writes Preset into the target value.

Usage

Three buttons that switch the lobby lighting between day, sunset and night colors for everyone:

  1. Create a Synchronized Color and connect it to your lights’ material with a Material Property applicator.
  2. Add three Color Preset prefabs, set Type to SYNCHRONIZED, reference the color and pick a preset color for each.
  3. On each UI button, add an On Click entry targeting the matching preset’s UdonBehaviour → SendCustomEvent → _Apply.

Presets can also be triggered without UI: from an Interact Trigger (click an object in the world), a Trigger Volume (walk into an area) or an Event Broadcaster.