# TrySetValue<T>(T)

> Sets a new value for the state option.

## Definition

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

```csharp
bool TrySetValue<T>(T value)
```

### Parameters

**** (T): The value to assign to the option’s UI field.

### Returns

| Type                                                          | Description                                                   |
| ------------------------------------------------------------- | ------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the value was successfully set; otherwise, `false`. |

### Remarks

This method allows for editor-time modification of a state option's value. It performs a type check and conversion internally. If the value cannot be cast to [IStateOption.DataType](/engine/6000.7/script-reference/unity/graphtoolkit/editor/istateoption/datatype.md), the method returns `false`. This method triggers the [State.DefineState](/engine/6000.7/script-reference/unity/graphtoolkit/editor/state/definestate.md) method to update the state.
