Add a Trigger or Data port to a Script Graph
A Script Graph used as a Subgraph can receive data and logic from its parent graph. Add and define ports on a graph to choose what data graphs can send and receive.
For more information about Subgraphs, see Subgraphs and State Units.
Add ports from a graph
To add a Trigger Input, Trigger Output, Data Input, or Data Output port to a Script Graph:
Open the Script Graph you want to edit in the Graph window.
With no nodes or groups selected in the graph, open the Graph Inspector.
Select Add (+) under the port type you want to add:
Trigger Inputs
Trigger Outputs
Data Inputs
Data Outputs
In the Key field, enter a unique key name for the port. The Key value can't match the Key of any existing ports on the current Script Graph.
In the Label field, enter a label to display for the port. The label displays on the Subgraph node and its Input or Output node.
In the Summary field, enter a brief summary of the port to display in the Graph Inspector when you select the Subgraph node, Input node, or Output node.
Toggle Hide Label to do the following:
Enable Hide Label to hide the port label on any Subgraph node, Input node, or Output node.
Disable Hide Label to display the data from the Label field.
(Data Inputs and Data Outputs Only) Set a data type for the port:
Select the Type list to open the Type menu.
Select a data type from the list to set the data type the port accepts.
(Data Inputs Only) Enable Has Default Value to display the Default Value field. Disable Has Default Value to hide the Default Value field.
In the Default Value field, enter the default value the port uses if it doesn't receive a data input while the Script Graph runs.
NOTE
If two Key values are the same on the same graph, Visual Scripting ignores the second port definition and displays a warning in the Graph Inspector. If you change the Key value for a port after you've made a connection to that port in a graph, the connections break and you must reconnect them.
NOTE
If you don't set a Label, Visual Scripting uses the value from the Key field.
Add ports with Input and Output nodes
You can also use an Input node or an Output node to define ports on a Script Graph:
Open the Script Graph you want to edit in the Graph window.
[!include[vs-open-fuzzy-finder](./snippets/vs-open-fuzzy-finder.md)]
Go to Nesting.
Do one of the following:
To add a Trigger Input or Data Input port to the graph, select Input.
To add a Trigger Output or Data Output port to the graph, select Output.
Select the new Input or Output node in the graph.
Open the Graph Inspector.
In the Key field, enter a unique key name for the port. The Key value can't match the Key of any existing ports on the current Script Graph.
In the Label field, enter a label to display for the port. The label displays on the Subgraph node and its Input or Output node.
In the Summary field, enter a brief summary of the port to display in the Graph Inspector when you select the Subgraph node, Input node, or Output node.
Toggle Hide Label to do the following:
Enable Hide Label to hide the port label on any Subgraph node, Input node, or Output node.
Disable Hide Label to display the data from the Label field.
(Data Inputs and Data Outputs Only) Set a data type for the port:
Select the Type list to open the Type menu.
Select a data type from the list to set the data type the port accepts.
(Data Inputs Only) Enable Has Default Value to display the Default Value field. Disable Has Default Value to hide the Default Value field.
In the Default Value field, enter the default value the port uses if it doesn't receive a data input while the Script Graph runs.
NOTE
If two Key values are the same on the same graph, Visual Scripting ignores the second port definition and displays a warning in the Graph Inspector. If you change the Key value for a port after you've made a connection to that port in a graph, the connections break and you must reconnect them.
NOTE
If you don't set a Label, Visual Scripting uses the value from the Key field.
Next steps
Add the Script Graph as a Subgraph in another Script Graph. For more information on how to add a Script Graph as a Subgraph, see Add a Subgraph to a Script Graph.
For more information on the port types on a Script Graph, see Subgraph node.
The defined Trigger and Data ports affect the ports on the Input and Output nodes in a Script Graph. For more information, see Input node and Output node.