I have function RegenHP it’s calculate current health point + regen hp divide max health point. Result fillAmount.
It’s run on Start() And OnApplicationPause().
But I have problem with Math.Lerp. I add HandleBar in Update(). When run game from background it’s lack not smoothly healthpoint bar regen. [When run app (not from background) it’s smoothy because it’s pass loadingScreen].
void HandleBar() {
if(displayedHealthBar.fillAmount != fillAmount) {
displayedHealthBar.fillAmount = Mathf.Lerp(displayedHealthBar.fillAmount, fillAmount, Time.deltaTime * lerpSpeed);
}
}