# GetStates()

> Retrieves all states in the state machine.

## Definition

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

```csharp
public IEnumerable<IState> GetStates()
```

### Returns

| Type                                                                                                    | Description                                                                                                                  |
| ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| [IEnumerable\<IState>](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1) | An `IEnumerable` of all [IState](/engine/6000.7/script-reference/unity/graphtoolkit/editor/istate.md)s in the state machine. |

### Remarks

Use this method to access every state in the state machine. States are returned in the order they were created.

The list includes:

* Your own [State](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state.md)s

* [ISubgraphState](/engine/6000.7/script-reference/unity/graphtoolkit/editor/isubgraphstate.md)s
