C# Unity3D when the player was attack I want to slow add player health until 100%. I try to add more health with this code by using PlayerHealth++ but it's very fast to add health that make player never die. How to fix it?
public class HealthScript : MonoBehaviour
{
[SerializeField] Text HealthText;
void Start()
{
HealthText.text = SaveScript.PlayerHealth + "%";
}
void Update()
{
SaveScript.PlayerHealth++;
HealthText.text = SaveScript.PlayerHealth + "%";
}
}