# GetOptionByName(string)

> Retrieves a state option using its name.

## Definition

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

```csharp
public IStateOption GetOptionByName(string name)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The unique name of the option.

### Returns

| Type                                                                                      | Description                                                   |
| ----------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
| [IStateOption](/engine/6000.7/script-reference/unity/graphtoolkit/editor/istateoption.md) | The option with the specified name, or null if none is found. |

### Remarks

The option's name is unique within the state's options.

### Examples

```csharp
if (myState.GetOptionByName("speed") is { } speed && speed.TryGetValue<float>(out var value))
    Debug.Log(value);
```
