Skip to main content

Notify

Overview

A class to wrap around a value to get callbacks when the value changes.

Events

public delegate void OnValueChange(T newValue)
public delegate void OnValueChangeWithOld(T oldValue, T newValue)

Example

public Notify<float> Health;

private void Awake()
{
Health = new Notify<float>(100)
// Make the UI update whenever the value of health changes
Health.onValueChange += UIManager.Instance.OnHealthChange;
}