Library -Artifacts
3.1 KiB
Add a Subgraph to a Script Graph
A Subgraph is a Script Graph nested inside of another Script Graph. A Subgraph appears as a single node inside a parent Script Graph. For more information on the Subgraph node, see Subgraph node.
You can add a Subgraph to a Script Graph in two ways: create a new Script Graph, or add an existing Script Graph file.
Add a new Subgraph to a Script Graph
To add a new blank Subgraph to an existing Script Graph:
[!include[with-graph-open-ff](./snippets/vs-with-graph-open-ff.md)]
Go to Nesting.
Select Subgraph to add a Subgraph node to the graph.
Open the Graph Inspector.
In the Graph Inspector, choose the source for the Subgraph:
Embed: The Subgraph only exists on the Subgraph node. You can only change the Subgraph from the node in its parent graph.
Graph: The Subgraph exists in a separate file. You can change the Subgraph outside of its parent graph and reuse the graph in other areas of an application.
If you chose Graph:
In the Graph Inspector, select New.
Enter a name for the graph file.
Choose where you want to save the graph file in the project.
Select Save.
Add an existing Script Graph as a Subgraph
To add an existing graph file as a Subgraph in a Script Graph:
Note
You can't nest a Script Graph as a Subgraph in its own graph file.
-
[!includewith-graph-open-ff]
-
Go to Nesting.
-
Select Subgraph to add the Subgraph node to the graph.
-
Open the Graph Inspector.
-
In the Graph Inspector, set the Source to Graph.
-
Do one of the following:
- In the Graph field, select the object picker (circle icon) and choose a compatible Script Graph from the project.
- Click and drag a Script Graph file from the Project window and release on the Graph field.
Tip
For a faster way to add a Script Graph as a Subgraph:
- Click and drag a Script Graph asset from the Project window into the Graph Editor to automatically create a Subgraph node.
- Right-click to open the fuzzy finder. Go to Graphs and select a graph file.
Next steps
To open the new Subgraph and edit the graph, select Edit Graph.
After you've added a Subgraph to a Script Graph, define its ports. For more information, see Add a Trigger or Data port to a Script Graph.