World Utilities / UI

Labels

Display float, int, string and URL values in TextMeshPro texts using format strings.

since v0.1.0localsynchronizedpersisted
Component Add Component menu / prefab Source
Local Float LabelVRCTools.World.LocalValues.UI.LocalFloatLabel Local Values › UI › Local Float Labelprefab: Percentage Label.prefab LocalFloatLabel.cs ↗
Local Int LabelVRCTools.World.LocalValues.UI.LocalIntLabel Local Values › UI › Local Int Labelprefab: Int Label.prefab LocalIntLabel.cs ↗
Synchronized Float LabelVRCTools.World.SynchronizedValues.UI.SynchronizedFloatLabel Synchronized Values › UI › Synchronized Float Labelprefab: Percentage Label.prefab SynchronizedFloatLabel.cs ↗
Synchronized Int LabelVRCTools.World.SynchronizedValues.UI.SynchronizedIntLabel Synchronized Values › UI › Synchronized Int Labelprefab: Int Label.prefab SynchronizedIntLabel.cs ↗
String LabelVRCTools.World.Values.UI.StringLabel Values › UI › String Labelprefab: String Label.prefab StringLabel.cs ↗
Value URL LabelVRCTools.World.Values.UI.ValueUrlLabel Values › UI › Value URL Labelprefab: URL Label.prefab ValueUrlLabel.cs ↗

Labels write the current state of a value into a TextMeshProUGUI text on the same game object and update it whenever the value changes.

Format strings

The text you type into the TextMeshPro component is the template. When the label starts, it remembers that text and from then on renders it with C#’s string.Format, passing the value as the only argument {0}:

Template Value Result
{0} 42 42
Players: {0} 12 Players: 12
Volume {0:0}% 57.3 Volume 57%
Brightness: {0:000}% 7 Brightness: 007%
{0:0.00} 0.4567 0.46
MOTD: {0} "Hi!" MOTD: Hi!

Put the template into the TextMeshPro text before entering play mode or uploading. Changing the text at runtime does not change the template.

Float & int labels

There is one component per type and kind: use the Local labels for local and persisted values and the Synchronized labels for synchronized values.

Parameter Default (float / int) Description
Local Value / Synchronized Value None The value to display. Required.
Enable Mapping false Advanced. Map the value’s restricted range onto Range.
Range 0 .. 100 Advanced. Display range for Minimum Value .. Maximum Value.
Multiplier 100 / 1 Advanced. Factor applied after mapping.

The displayed number is calculated exactly like a slider’s: mapping applies only when Enable Mapping is ticked and the value is restricted; the multiplier is always applied.

Float labels default to a multiplier of 100 - perfect for showing a 0 .. 1 value as a percentage ({0:0}%). Set it to 1 to show the raw number.

String label

Displays a string value.

Parameter Default Description
Type LOCAL Kind of the value.
Source None The string value to display. Required.

URL label

Displays a URL value - for example to show which image or video is currently loaded.

Parameter Default Description
Type LOCAL Kind of the value.
Source None The URL value to display. Required.