Visual Script: Logic Nodes
Logic
Logic nodes provide flow control and conditional execution in visual scripts. This group contains boolean operators, conditions, loops, and comparison operations that form the foundation of script logic.
Essential logic nodes:
Branch: Anifcondition node with two execution paths based on a boolean valueSwitch: Several variants to map one value to multiple possible execution pathsCompare: Checks whether two values are equal, returning a boolean resultIs Valid: Checks whether a value (such as a game object or component reference) is still valid and can be used
Additional logic operations include:
- Boolean operators - AND, OR, NOT for combining conditions
- Loops - For, while, and foreach loops for iteration (see loops and arrays)
- Numeric comparisons - Greater than, less than, etc.
- Null checks - Verify references before use
Logic nodes control the flow of script execution and are used in nearly every visual script. Combine them with math nodes for numerical logic and string nodes for text comparisons.