Version: Unity 6.5 Alpha (6000.5)
Language : English
Types of nested graphs
Add comments to graphs

Organize with nested graphs

Organize complex graphs with nested graphs, or subgraphs.

Large, complex graphs can be difficult to understand. To simplify a graph, you can collapse part of it into levels of nested graphs, called subgraphs. This makes the overall graph easier to read. You can also focus on the content within the subgraphs with less visual distraction.

This information covers nested graphs only. For information on other ways to organize graphs, refer to Organize graphs.

Prerequisites

Before you can use nested graphs, you must:

  1. Set up the code structure for the graph.
  2. Create a graph class.
  3. Create a node.

Use subgraphs

Create subgraphs to simplify the graph. Expand subgraphs to undo the nesting and return the content to a higher level of the graph.

Create a subgraph

To add a subgraph:

  1. Add GraphOptions.SupportsSubgraph in the Graph attribute’s options parameter:

    [Graph(AssetExtension, GraphOptions.SupportsSubgraphs)]

  2. Create a subgraph node.

    To create a local subgraph, use one of the following methods:

    • Right-click on the canvas, and select Create Empty Local Subgraph.
    • Right-click a placemat’s heading/title, and select Convert to Local Subgraph.
    • Right-click a node or nodes, and select Create Local Subgraph from Selection.

    To add another local subgraph if one exists in the graph:

    1. Right-click on the canvas, and select Add Node. The Add a graph node window appears.
    2. Double-click on the local subgraph.

    To create an asset subgraph, you must already have a graph asset with a valid subgraph type. To create the asset subgraph, use one of the following methods:

    • Drag a graph asset from the Project windowA window that shows the contents of your Assets folder (Project tab) More info
      See in Glossary
      into the Graph window.

    • Create the asset subgraph from the Add a graph node window:

      1. Right-click on the canvas, and select Add Node. The Add a graph node window appears.
      2. Double-click on the asset subgraph.

A subgraph node appears. It has a different shape from other nodes. A subgraph node has a tab on top.

Open and close a subgraph

To view a subgraph in detail and interact with its contents, open the subgraph. You can open the subgraph through one of these methods:

  • Right-click the subgraph node, and select Open Local Subgraph.
  • Double-click the subgraph node.
  • Select the Enter Subgraph icon on the subgraph node.

After you open the subgraph, the canvas and the MiniMap window show only the contents of the subgraph.

To close the subgraph and return to a higher level of the graph, use the breadcrumbs at the top of the Graph view to select the graph or subgraph you want to view.

After you close the subgraph, the canvas and the MiniMap window show the level of the graph that you selected.

Extract a subgraph

To return the contents of a subgraph to a higher level of the graph:

  1. Navigate to the level of the graph with the subgraph node.

  2. Extract the contents of the subgraph through one of the following steps:

    • Right-click the subgraph node, and select Extract Contents to Placemat.
    • Select the subgraph node, and select Shift+Ctrl+U on the keyboard.

After you extract the subgraph, its contents appear on a placemat one level higher in the graph. The placemat title is the name of the subgraph. If you extract a subgraph that had subgraphs nested inside it, the nested subgraphs will appear as subgraph nodes on the placemat.

Delete the subgraph

To delete the subgraph and its contents:

  1. Navigate to the level of the graph with the subgraph node.
  2. Delete the node through one of the following methods:
    • Right-click the subgraph node, and select Delete.
    • Select Del on the keyboard.

After you delete the subgraph, the subgraph node and its contents disappear from the graph.

Additional resources

Types of nested graphs
Add comments to graphs