GraphDatabase
Provides functionality needed to access, and perform operations on, graph assets.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Class
- Namespace: Unity.GraphToolkit.Editor
- Assembly: UnityEditor
public static class GraphDatabase
Remarks
The class is similar to Unity's AssetDatabase, but it is tailored for graph-based tools. Use this class to create, load, and save Graph instances and their associated assets. This API supports typical asset workflows such as creating new graph assets in the Project window, accessing graphs by path or GUID, and ensuring changes to graph data are saved.
GraphDatabaseUse GraphDatabase.PromptInProjectBrowserToCreateNewAsset to create and name a new asset, GraphDatabase.CreateGraph to generate an asset file, and GraphDatabase.LoadGraph to retrieve an existing one.
Use GraphDatabase.SaveGraph to persist graph data changes, and GraphDatabase.LoadGraphForImporter to load a clean instance during import.
Static Methods
Method | Description |
|---|---|
| CreateGraph | Creates a new graph asset of type |
| GetGraphAssetGUID | Retrieves the globally unique identifier (GUID) for the asset associated with the specified Graph. |
| GetGraphAssetPath | Retrieves the file path of the asset associated with the specified Graph. |
| LoadGraph | Loads a Graph of type |
| LoadGraphForImporter | Loads a fresh instance of the Graph of type |
| PromptInProjectBrowserToCreateNewAsset | Creates a new graph asset and activates the naming field in the Project Browser. |
| SaveGraph | Saves the asset of the specified Graph to disk if it has unsaved changes. |