Conversion and Text
When you need a conversion node
Most of the time you do not. Numbers convert between themselves automatically, and nearly anything converts to text — connect a float output to a string input and it just works.
You need an explicit conversion in two cases:
- You have a Variant — a value whose type is not known ahead of time — and need a usable value out of it.
- You want to force a specific type, such as truncating a float to an int.
Variants turn up as array elements, blackboard values, and the output of anything that can return different types.
Variant_ConvertTo
The important one.
| Title | ConvertTo {Type} |
| Execution in | unnamed |
| Execution out | Succeeded, Failed |
| Data in | Variant — Variant, required |
| Data out | Result — Any |
| Property | Type — the target type |
This is the only conversion node that can fail visibly, which is why it branches.
If the Variant does not hold something compatible, execution leaves through
Failed and Result is not usable.
Wire Failed to a Warning while building a script — a silent wrong-type
conversion is one of the harder things to spot.
The direct conversion nodes
Eight nodes, all with the same shape: one unnamed required input of any type, one unnamed output of the target type, no execution pins.
| Node | Converts to |
|---|---|
ToBool | Bool |
ToByte | Byte |
ToInt | Int |
ToInt64 | Int64 |
ToFloat | Float |
ToDouble | Double |
ToString | String |
ToVariant | Variant |
These convert silently. Narrowing a float to an int truncates rather than rounding.
HashedString is the one type without a conversion node. Connect a String pin
directly to a HashedString pin and the conversion happens implicitly.
String_Format
Builds text from a pattern and a set of values.
| Title | Format {Text} |
| Execution | none |
| Data in | Text — String; Params — one pin per parameter you add |
| Data out | "" — String |
| Properties | Text, Params |
Write the pattern in the Text property using numbered placeholders, then add
entries to Params — the node grows an input pin for each:
Text: Health: {0} / {1}
Params[0] -> current health
Params[1] -> max health
Any type can be plugged into a parameter pin; it is converted to text automatically.
This is what makes debug output readable. Paired with Draw3DText it gives
you labelled values in the world, which is far easier to interpret than a bare
number. See the raycast recipe.