# TrySetValue<T>(T)

> Sets the value of the constant node to the specified value of type T.

## Definition

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

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

### Parameters

**** (T): The value to set.

### Returns

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

### Remarks

This method provides type-safe access to the constant's stored value. It performs a type check and conversion internally. If the value cannot be cast to [IConstantNode.DataType](/engine/6000.6/script-reference/unity/graphtoolkit/editor/iconstantnode/datatype.md), the method returns `false`.
