World Utilities / Converters
Converters
Converters listen to one or more values and write a derived result into another value.
A converter sits between values. Whenever one of its inputs changes, it recomputes its result and writes it into a target value, which in turn notifies its own subscribers. Because the result is just another value, converters can be chained and their output can be used by anything that accepts a value: applicators, UI, other converters or your scripts.
[ Synchronized Boolean ] ─┐
"owner enabled music" ├─▶ [ Boolean Operation: AND ] ──▶ [ Local Boolean ] ──▶ [ Object Toggle ]
[ Persisted Boolean ] ─┘ "music on" Music Player
"player wants music"
Most inputs offer three source types:
| Type | Reads from |
|---|---|
STATIC |
a constant entered in the inspector |
LOCAL |
a local value - persisted values work here too |
SYNCHRONIZED |
a synchronized value |
Write converter results into a local value whenever possible. Every client runs the converter itself, so a synchronized target would make every player fight over ownership of the same value.
- Boolean OperationCombines one or two boolean values using NOT, AND, OR, XOR, NAND, NOR or XNOR.
- Color AdjustmentDerives a new color by offsetting the hue, saturation and value (brightness) of another color.
- Color ComponentBuilds a color from four float values (red, green, blue, alpha) - for example three sliders.
- Float MathAdds, subtracts, multiplies or divides two float inputs and writes the result into a float value.
- Int MathAdds, subtracts, multiplies, divides or takes the remainder of two int inputs.
- Texture2D LoaderDownloads an image from a URL value and stores it in a Texture2D value, with placeholders for loading and errors.