> For the complete documentation index, see [llms.txt](https://docs.yarnspinner.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.yarnspinner.dev/api/csharp/yarn.unity/yarn.unity.variablestoragebehaviour/yarn.unity.variablestoragebehaviour.addchangelistener-2.md).

# AddChangeListener(System.Action\<string, object>)

Method in [VariableStorageBehaviour](/api/csharp/yarn.unity/yarn.unity.variablestoragebehaviour.md)

## Summary

Registers a delegate that will be called when any variable is modified.

```csharp
public IDisposable AddChangeListener(System.Action<string, object> onChange)
```

## Parameters

| Name                              | Description                                          |
| --------------------------------- | ---------------------------------------------------- |
| `Action<string, object>` onChange | The delegate to run when the variable changes value. |

## Returns

An `System.IDisposable` that removes the registration when its `System.IDisposable.Dispose` method is called.
