Hey I’m trying to set up an xp bar with an image. I had it set up with a slider previously so I was just able to make the max value of the slider equal the target xp but I’m having difficulty trying to convert my code to work with image.fillAmount instead since that only works with 0f -1f. I want to display the current xp with the fill amount of the image and also allow for extra xp (if you gain 100xp when you only need 50xp that extra 50 should be carried over to the next) to be shown with the image as well.
public void AddExp(float ExpGain)
{
CurrentExp = CurrentExp + ExpGain;
//ExpBar.fillAmount = ?
while (CurrentExp >= TargetExp)
{
CurrentExp = CurrentExp - TargetExp;
//ExpBar.fillAmount = ?
Level++;
TargetExp = TargetExp + 100;
LevelText.text = Level.ToString();
if (currentHealth != maxHealth)
{
StartCoroutine(RegenHealth());
}
}
}