Types of Nodes
In Visual Scripting, you define your logic through a series of nodes. There are different types of nodes that help you work with logic, Lens Studio, and more.
Event Node
The root of any action in the graph. Information about the event, like the position of the touch in a TouchStartEvent, can be accessed by using the self
port in the upper right hand corner.
Input Node
How to get outside input from the scene into the graph via the Script
Component. If used inside a sub-graph it can either take input from the next graph level up, or on the Script
Component as usual. Analogous to //@input
when writing script code.
Asset Reference
Drag and drop any asset into the graph to create this node which then provides a reference to that asset without needing to otherwise use it in the scene. A Material referenced this way will populate the getProperty
and setProperty
nodes with the properties exposed by that Material for easy connections to Material Editor materials.
Custom Node
Drag and drop any script file into the graph to create a node which will execute the contents of the script. Use the normal // @input
syntax to create input ports to the node, and a similar // @output
syntax to create output ports. Useful for writing more computational small functions if you are comfortable, or working with scripts shared by other creators.
Take a look at the custom node guide for more information about input and outputs.
Sequence Node
A useful organizational tool that lets you split execution into multiple lines that will run in sequence. Functionally no different than connecting the end of one to the beginning of the next, but helps keep discrete parts of your graph separate.
Variable Nodes
These are two nodes, getVariable
and setVariable
which allow you to store values between events. The variables your graph uses are configured in the sidebar of the Visual Script Editor.
Control Flow Nodes
All the usual control flow options are available, if
is the most important but while
, for
, break
, and continue
are all there as well.
Sub-Graphs
Sub-graphs are another organizational tool which allow you to separate a section of the graph into another layer, exposing inputs and outputs from that section. They are useful for encapsulating chunks of logic like the Lerp function below, and can be exported and reused in different graphs.