You can use a Boolean cast node to convert a Boolean value to a float, an integer, or a string. In each case you can choose how the Boolean true or false value is represented in the target type.
For example, the default outputs for the Bool To String node are "true" and "false", but you could change them to "on" and "off", or "open" and "closed", or any other pair of strings.
The available nodes to cast a Boolean to another data type
Inputs:
Name
Type
Description
Input
Boolean
The value to be converted.
True Value
<varies> [editable]
The value to output if the input is true.
False Value
<varies> [editable]
The value to output if the input is false.
Outputs:
Name
Type
Description
Output
<varies>
The converted value.
The output depends on the chosen node, and is either a float, an integer, or a string.
Boolean logic nodes
Perform Boolean logic operations on the provided inputs. All inputs and outputs are Boolean values.
The available Boolean logic nodes
Name
Operation
Bool And
Output is true if both A and B are true.
Bool Or
Output is true if either A or B are true.
If you need a node that's equivalent to a Not logical operation, see Invert Bool.
Logic Bool Changed
Outputs true in the frame where the input value changes from true to false or from false to true.
Logic Bool Changed node
Inputs:
Name
Type
Description
Input
Boolean
The Boolean value to monitor.
Outputs:
Name
Type
Description
Output
Boolean
True when the Input changes, but resets to false at the end of the frame.
Example
In the following example, the referenced float is incremented by one each time that the referenced Boolean changes.
Example graph to increment a float each time that a Boolean changes
Bool Constant
Outputs a true or false Boolean value. An AFX graph cannot change the value of this node.
You can open an AFX graph to change the value of this node in the Unity Editor.
Outputs:
Name
Type
Description
Output
Boolean [editable]
A true or false value.
Get Bool
Converts a reference to a Boolean component to a Boolean value.
Inputs:
Name
Type
Description
Bool Component
Bool Component
Reference to a Boolean component.
Outputs:
Name
Type
Description
Bool Out
Boolean
The true or false value of the Boolean component.
Invert Bool
Inverts a Boolean value. If the input is true, the output is false. If the input is false, the output is true.
Inputs:
Name
Type
Description
Input
Boolean
The value to be inverted.
Outputs:
Name
Type
Description
Output
Boolean
The inverted value of the Input.
Set Bool
Sets the value of a Boolean component.
Inputs:
Name
Type
Description
Enter
Flow
Flow to activate the node.
Bool Component
Boolean component
Reference to the Boolean component for which you want to set the value.
Value In
Boolean [editable]
The value that the Boolean component will be set to.