# State

> The base class for all user-accessible states in a State.StateMachine.

## Definition

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

```csharp
public abstract class State : IState
```

## Remarks

Inherit from this class to define custom state types that appear in a state machine graph. A state represents a node in a [State.StateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/statemachine.md); transitions connect states to one another. Unlike [Node](/engine/6000.7/script-reference/unity/graphtoolkit/editor/node.md), a state does not expose configurable input and output ports: its incoming and outgoing transition connections are managed by the state machine itself.

See also:

* [State.StateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/statemachine.md) for the graph type that contains states

* [Node](/engine/6000.7/script-reference/unity/graphtoolkit/editor/node.md) for the equivalent base class used in regular graphs

* [IState](/engine/6000.7/script-reference/unity/graphtoolkit/editor/istate.md) for the interface this class implements

## Properties

| Property                                                                                        | Description                                                                                                                         |
| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| [DefaultColor](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/defaultcolor.md) | The highlight color of the state. The highlight is located on the upper border of the state.                                        |
| [FillAmount](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/fillamount.md)     | The progress fill amount displayed on the state's accent bar, expressed as a percentage.                                            |
| [ID](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/id.md)                     | The globally unique identifier for this state.                                                                                      |
| [IsConnected](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/isconnected.md)   | Whether the state is connected to at least one transition.                                                                          |
| [OptionCount](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/optioncount.md)   | The number of options defined in the state.                                                                                         |
| [Options](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/options.md)           | The options defined on this state.                                                                                                  |
| [Position](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/position.md)         | The position of the state in the state machine.                                                                                     |
| [StateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/statemachine.md) | The [State.StateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/statemachine.md) that contains this state. |
| [Subtitle](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/subtitle.md)         | The secondary text displayed in the state's header.                                                                                 |
| [Title](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/title.md)               | The main text displayed in the state's header.                                                                                      |
| [Tooltip](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/tooltip.md)           | The text displayed when hovering over the state's header.                                                                           |

## Methods

| Method                                                                                                              | Description                                                                                                                                                     |
| ------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [DefineState](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/definestate.md)                       | Defines the structure of the state by building its options.                                                                                                     |
| [GetIncomingTransitions](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/getincomingtransitions.md) | Retrieves the transitions that go to this state.                                                                                                                |
| [GetOption](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/getoption.md)                           | Retrieves a state option using its zero-based index.                                                                                                            |
| [GetOptionByName](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/getoptionbyname.md)               | Retrieves a state option using its name.                                                                                                                        |
| [GetOutgoingTransitions](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/getoutgoingtransitions.md) | Retrieves the transitions that originate from this state.                                                                                                       |
| [OnDefineOptions](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/ondefineoptions.md)               | Called during [State.DefineState](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/definestate.md) to define the options available on the state. |
| [OnDisable](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/ondisable.md)                           | Called when the state is removed or when the state machine is disabled.                                                                                         |
| [OnEnable](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/onenable.md)                             | Called when the state is created or when the state machine is enabled.                                                                                          |
| [RemoveFromStateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/removefromstatemachine.md) | Removes the state from its state machine.                                                                                                                       |

## Interfaces

| Interface                                                                                                                     | Description                                                              |
| ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| [State.IOptionDefinitionContext](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/ioptiondefinitioncontext.md) | Interface that provides methods to declare state options inside a state. |
