# SaveGraph(Graph)

> Saves the asset of the specified Graph to disk if it has unsaved changes.

## Definition

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

```csharp
public static void SaveGraph(Graph graph)
```

### Parameters

**** (\[Graph]\(/engine/6000.7/script-reference/unity/graphtoolkit/editor/graph)): The graph to save.

### Remarks

Use this method to persist any pending modifications made to a [Graph](/engine/6000.7/script-reference/unity/graphtoolkit/editor/graph.md) instance. It prevents data loss by ensuring the asset on disk reflects the in-memory graph state. This method is similar to [AssetDatabase.SaveAssetIfDirty](/engine/6000.7/script-reference/unityeditor/assetdatabase/saveassetifdirty.md) and only performs a save if the graph is marked dirty.
