Documentation

Support

Unity Studio

Open Unity Studio

Unity Studio

Convert node

Convert values between different types, such as from a float to an integer.
Read time 1 minuteLast updated 17 hours ago

The Convert node converts values to different types. This is useful when you need to change the type of a value to use it with other nodes that require a specific type. For example, you might want to convert a float to an integer to use it as an index in an array.

Methods

Expand the Convert node to view available variables and methods you can use:

Method

Return type

Description

To Int
int
Converts a float, string, or bool value to an integer by rounding it to the nearest whole number.
To Float
float
Converts a string, int, or bool value to a float.
To String
string
Converts an int, float, or bool value to its string representation. This is useful if you want to display values in the UI, log information for debugging purposes, or when you need to concatenate values into a message.
To Bool
bool
Converts an int, float, or string value to a bool value. The conversion rules depend on the type of the input value. For example, if you convert a float or int, any non-zero value converts to true, while zero converts to false. When you convert a string, an empty string converts to false, while any non-empty string converts to true. This is useful to evaluate conditions or control the flow of your Logic script.

Additional resources