If you want all the healthbars to look exactly alike instead of sort of in a curve around the camera you can do it like this.
void LateUpdate()
{
transform.forward = _invert? _cameraTransform.forward * -1 : _cameraTransform.forward;
}
}
Matching the camera forward vector gives you a uniform look on all the healthbars.
Also if you want the healthbar to change color it’s really easy to do. Just add this code at the top
[SerializeField] Gradient _healthBarGradient;
Then add this line when you update the fill amount.
void UpdateHealthBarFill()
{
_healthBar.fillAmount = _healthsystem.GetHealthPercentage();
_healthBar.color = _healthBarGradient.Evaluate(_healthBar.fillAmount);
}
and then make a gradient that you like.