private void Start() { if (player == null) { player = GameObject.FindObjectOfType <PlayerHealthSystemTest>(); } SceneManager.sceneUnloaded += DereferencePlayerHealth; healthText = GetComponentInChildren <TextMeshProUGUI>(); UpdateHealthText(player.GetCurrentHP()); player.OnPlayerHealthUpdate += UpdateHealthText; }
private void MakeThisObjectSingleton() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }