# GetSubgraphAsGraph()

> Retrieves the subgraph linked to this state as a Graph.

## Definition

* **Type:** Method
* **Namespace:** [Unity.GraphToolkit.Editor](/engine/6000.7/script-reference/unity/graphtoolkit/editor.md)
* **Assembly:** UnityEditor

```csharp
Graph GetSubgraphAsGraph()
```

### Returns

| Type                                                                        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Graph](/engine/6000.7/script-reference/unity/graphtoolkit/editor/graph.md) | The [Graph](/engine/6000.7/script-reference/unity/graphtoolkit/editor/graph.md) instance that this state references, or `null` if the referenced subgraph is a [StateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachine.md) (use [ISubgraphState.GetSubgraphAsStateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/isubgraphstate/getsubgraphasstatemachine.md) instead) or no subgraph is set. |
