# Variable<T>

> Base class for all single source variables. Inherit from this class for storage for a single serialized source value that will send a value changed event when Variable<T>.Value is changed. This will trigger any localized string that is currently using the variable to update.

## Definition

* **Type:** Class
* **Namespace:** [Unity.SmartStrings.PersistentVariables](/engine/6000.7/script-reference/unity/smartstrings/persistentvariables.md)
* **Assembly:** UnityEngine.SmartStringsModule
* **Implements:** [IVariableValueChanged](/engine/6000.7/script-reference/unity/smartstrings/persistentvariables/ivariablevaluechanged.md), [IVariable](/engine/6000.7/script-reference/unity/smartstrings/persistentvariables/ivariable.md), [ISerializationCallbackReceiver](/engine/6000.7/script-reference/unityengine/iserializationcallbackreceiver.md)

```csharp
public class Variable<T> : IVariableValueChanged, IVariable, ISerializationCallbackReceiver
```

## Properties

| Property                                                                                           | Description                                                                                                                                                                                      |
| -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Value](/engine/6000.7/script-reference/unity/smartstrings/persistentvariables/variable1/value.md) | The value for this variable. Changing this will trigger the [Variable\<T>.ValueChanged](/engine/6000.7/script-reference/unity/smartstrings/persistentvariables/variable1/valuechanged.md) event. |

## Methods

| Method                                                                                                   | Description                                                 |
| -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
| [ToString](/engine/6000.7/script-reference/unity/smartstrings/persistentvariables/variable1/tostring.md) | Returns the string representation of this variable's value. |

## Events

| Member                                                                                                           | Description                                                                                                                          |
| ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| [ValueChanged](/engine/6000.7/script-reference/unity/smartstrings/persistentvariables/variable1/valuechanged.md) | Raised when [Variable\<T>.Value](/engine/6000.7/script-reference/unity/smartstrings/persistentvariables/variable1/value.md) changes. |
