I got this code which determines the size of the health bars in my game.
void OnChangeHealth (float Health)
healthBar.sizeDelta = new Vector2(Health, healthBar.sizeDelta.y);
When my units get lots of hp the bar becomes ridiculously long. Can someone please tell me how to make the health bar size depend on percentage of remaining health instead?
Thanks in advance!