VariableStorageBehaviour.AddChangeListener(string,Action)

Method in VariableStorageBehaviour

Summary

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

public IDisposable AddChangeListener<T>(string variableName, Action<T> onChange)

Parameters

NameDescription
string variableNameThe name of the variable to watch for changes to. This variable must be of type T , and it must not be a smart variable.
Action<T> onChangeThe delegate to run when the variable changes value.

Type Parameters

NameDescription
TThe type of the variable.

Returns

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