// Update is called once per frame void Update() { float playerHealth = playerHealthComponent.GetHealth(); if (this.playerHealth == playerHealth) { return; } healthText.text = (playerHealth <= 0) ? "0" : playerHealth.ToString(); this.playerHealth = playerHealth; }