Hey all, I am trying to get a basic health bar working, and I'm not sure why it's not working. My code seems fine, but I can't find where the bug is. Code (csharp): public int maxHealth; public int currentHealth; public Image healthbar; public void TakeDamage(int damage) { current Health -= damage; UpdateHealthBar(); } public void UpdateHealtgBar() { healthbar.fillAmount = (currentHealth / maxHealth); } Every time I run the code, and put in debuts, the currentHealth / max Health is always 0. Which doesn't make much sense to me. Any ideas?
currentHealth and maxHealth are both integers, so you are performing an integer division. Cast to float to get a float result