using UnityEngine;using UnityEngine.UI;publicclassPlayerStats : MonoBehaviour {publicText scoreText; //populate in the inspectorpublicText healthText;// Use this for initializationvoidStart () {////make connection with Text component on GameObjectUpdateDisplay();GameData.instanceRef.onPlayerDataUpdate.AddListener(UpdateDisplay); }voidUpdateDisplay() {healthText.text="Health: "+GameData.instanceRef.Health;scoreText.text="Total Score: "+GameData.instanceRef.Score ; }}//end class