World Utilities / Values
String
A piece of text - announcements, names and messages.
since v0.1.0localsynchronizedpersistednetworked
| Component | Add Component menu / prefab | Source |
|---|---|---|
Local StringVRCTools.World.LocalValues.LocalString
|
Local Values › Local Stringprefab: Local String.prefab
|
LocalString.cs ↗ |
Synchronized StringVRCTools.World.SynchronizedValues.SynchronizedString
|
Synchronized Values › Synchronized Stringprefab: Synchronized String.prefab
|
SynchronizedString.cs ↗ |
Persisted StringVRCTools.World.PersistedValues.PersistedString
|
Persisted Values › Persisted Stringprefab: Persisted String.prefab
|
PersistedString.cs ↗ |
String values hold free text. Show them with a String Label, edit them with an Input Field and set them from buttons with a String Preset. A Synchronized String behind an input field makes an instant announcement board (“Welcome! We’re celebrating Kim’s birthday today!”).
Parameters
| Parameter | Default | Description |
|---|---|---|
| Default Value | "" |
The state the value is initialized with. |
| Key (persisted only) | PlayerData key used to store the value. Required - see choosing keys. |
Synchronized variants additionally expose the networking settings.
Networked values need a unique hierarchy path - see naming networked objects.
Events
| Event | Kinds | Description |
|---|---|---|
EVENT_STATE_UPDATED |
all | The state changed (also emitted once with the initial state). |
EVENT_STATE_RESET |
local, persisted | _Reset() restored the default value. |
EVENT_LOADED |
persisted | Stored data has been restored - see loading. |
EVENT_PERSIST |
persisted | The state has been written to player data. |
Functions
| Function | Kinds | Description |
|---|---|---|
_Clear() |
all | Sets the state to an empty string. |
_Reset() |
local, persisted | Restores Default Value. |
Synchronized strings are sent in full on every change. They are perfect for short messages, but avoid binding them to input fields that players type long texts into.