---
title: OnDefineSubgraphStateOptions(IOptionDefinitionContext)
product: Unity Editor
version: '7000.0'
latest_version: '7000.0'
status: This page documents version 7000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/graphtoolkit/editor/statemachine/ondefinesubgraphstateoptions
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/graphtoolkit/editor/statemachine/ondefinesubgraphstateoptions.md
last_updated: 2026-10-29
generated_at: 2026-11-12T18:51:34.292Z
locale: en-us
---

# OnDefineSubgraphStateOptions(IOptionDefinitionContext)

> Called to define the IStateOption s available on subgraph states that reference this type of state machine. Similar in function to State.OnDefineOptions.

## Definition

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

```csharp
protected virtual void OnDefineSubgraphStateOptions(State.IOptionDefinitionContext context)
```

### Parameters

**** (\[IOptionDefinitionContext]\(/engine/7000.0/script-reference/unity/graphtoolkit/editor/state/ioptiondefinitioncontext)): Provides methods for defining state options.

### Remarks

Override this method to add options to all [ISubgraphState](/engine/7000.0/script-reference/unity/graphtoolkit/editor/isubgraphstate.md)s that point to this type of state machine using the provided [State.IOptionDefinitionContext](/engine/7000.0/script-reference/unity/graphtoolkit/editor/state/ioptiondefinitioncontext.md). This method is only applicable when the state machine is referenced by a subgraph state, in a state machine that supports subgraphs through [StateMachineOptions.SupportsSubgraphs](/engine/7000.0/script-reference/unity/graphtoolkit/editor/statemachineoptions/supportssubgraphs.md). Like the options of a [State](/engine/7000.0/script-reference/unity/graphtoolkit/editor/state.md), the options of a subgraph state only appear in the graph inspector when the subgraph state is selected.

### Examples

```csharp
protected override void OnDefineSubgraphStateOptions(State.IOptionDefinitionContext context)
{
    context.AddOption<int>("ID")
        .WithTooltip("The ID of the subgraph.")
        .Delayed();

    context.AddOption<string>("Description")
        .WithDefaultValue("What is the purpose of this subgraph?")
        .Delayed();
}
```
