# CreateGraph<T>(string)

> Creates a new graph asset of type T at the specified file path.

## Definition

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

```csharp
public static T CreateGraph<T>(string assetPath) where T : Graph, new()
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The relative path for the new asset (e.g., "Assets/Graphs/MyGraph.mygraph").

### Returns

| Type | Description                 |
| ---- | --------------------------- |
| T    | The created graph instance. |

### Remarks

Use this method to programmatically create a new graph asset of type `T` at a specific location in the project. The path must be relative to the Unity project folder and must include a valid file extension recognized by the graph importer. If an asset already exists at the specified `assetPath`, this method overwrites it. This method works similarly to [AssetDatabase.CreateAsset](/engine/6000.6/script-reference/unityeditor/assetdatabase/createasset.md) but is scoped for [Graph](/engine/6000.6/script-reference/unity/graphtoolkit/editor/graph.md) assets.
