Hello everyone.
If you want to display in your UI field level the amount of the next level, only mimic the health “GetMaxHealthPoints”.
So copy it, past it in your Experience script (after GetPoints Methode for exemple) and rename it like “GetMaxExperience” and change the stat.health by ExperienceToLevelup:
public float GetMaxExperience()
{
return GetComponent<BaseStats>().GetStat(Stat.ExperienceToLevelUp);//PV xp du niveau actuel
}
Then in your experienceDisplay script only tweak the Update by adding the /{1:0} and the second argument , experience.GetMaxExperience():
private void Update()
{
GetComponent<TextMeshProUGUI>().text = String.Format("{0,0}/{1:0}",experience.GetPoints(),experience.GetMaxExperience());
}
Save the two scripts and now you will have displaying the amount of the next level to reach in your UI:
Don’t forget to have a xp field for the diplaying enought large to be able to writte the whole numbers in the same line.
Have a nice day.
François