Files

18 lines
464 B
C#

using UnityEngine;
using TMPro; // Erforderlich für TextMeshPro
public class HealthUI : MonoBehaviour
{
[Header("Referenzen")]
public TextMeshProUGUI healthText;
public PlayerHealth playerHealth;
void Update()
{
if (healthText != null && playerHealth != null)
{
// Zeigt z. B. "HP: 100 / 100" an
healthText.text = "HP: " + playerHealth.currentHealth + " / " + playerHealth.maxHealth;
}
}
}