[OnValueSynced] Attribute
Notifying State Changes
Usage
using Coherence.Toolkit;
using UnityEngine;
using UnityEngine.UI;
public class Player : MonoBehaviour
{
[OnValueSynced(nameof(UpdateHealthLabel))]
public float Health;
public Text HealthLabel;
public void UpdateHealthLabel(float oldHealth, float newHealth)
{
HealthLabel.text = newHealth.ToString();
Debug.Log($"Player HP changed by: {newHealth - oldHealth}");
}
}Limitations
Was this helpful?

