# StateMachineDatabase

> Provides functionality needed to access, and perform operations on, state machine assets.

## Definition

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

```csharp
public static class StateMachineDatabase
```

## Remarks

The `StateMachineDatabase` class is the [StateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachine.md) counterpart of [GraphDatabase](/engine/6000.7/script-reference/unity/graphtoolkit/editor/graphdatabase.md). Use this class to create, load, and save [StateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachine.md) instances and their associated assets.

Use [StateMachineDatabase.PromptInProjectBrowserToCreateNewAsset](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachinedatabase/promptinprojectbrowsertocreatenewasset.md) to create and name a new asset, [StateMachineDatabase.CreateStateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachinedatabase/createstatemachine.md) to generate an asset file, and [StateMachineDatabase.LoadStateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachinedatabase/loadstatemachine.md) to retrieve an existing one.

Use [StateMachineDatabase.SaveStateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachinedatabase/savestatemachine.md) to persist state machine data changes, and [StateMachineDatabase.LoadStateMachineForImporter](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachinedatabase/loadstatemachineforimporter.md) to load a clean instance during import.

## Static Methods

| Method                                                                                                                                                             | Description                                                                                                                                                                            |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [CreateStateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachinedatabase/createstatemachine.md)                                         | Creates a new state machine asset of type `T` at the specified file path.                                                                                                              |
| [GetStateMachineAssetGUID](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachinedatabase/getstatemachineassetguid.md)                             | Retrieves the globally unique identifier (GUID) for the asset associated with the specified [StateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachine.md). |
| [GetStateMachineAssetPath](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachinedatabase/getstatemachineassetpath.md)                             | Retrieves the file path of the asset associated with the specified [StateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachine.md).                          |
| [LoadStateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachinedatabase/loadstatemachine.md)                                             | Loads a [StateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachine.md) of type `T` from the asset at the specified path.                                    |
| [LoadStateMachineForImporter](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachinedatabase/loadstatemachineforimporter.md)                       | Loads a fresh instance of the [StateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachine.md) of type `T` from disk for use in the asset import pipeline.    |
| [PromptInProjectBrowserToCreateNewAsset](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachinedatabase/promptinprojectbrowsertocreatenewasset.md) | Creates a new state machine asset and activates the naming field in the Project Browser.                                                                                               |
| [SaveStateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachinedatabase/savestatemachine.md)                                             | Saves the asset of the specified [StateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/statemachine.md) to disk if it has unsaved changes.                          |
