Question by
Baconaiter · Jan 01, 2017 at 10:50 PM ·
regeneration
What is wrong with this regeration script?
For some reason, this code does nothing when I run the game. I have no idea why.
void update()
{
if (health < maxhealth && !regenstate)
{
StartCoroutine(Regeneration());
if (health > maxhealth)
{
health = maxhealth;
}
}
}
public IEnumerator Regeneration()
{
regenstate = true;
WaitForSeconds TrueRegenDelay = new WaitForSeconds(regenDelay);
yield return TrueRegenDelay;
print("time");
health += regenAmount;
regenstate = false;
}
Comment
Best Answer
Answer by Baconaiter · Jan 01, 2017 at 11:23 PM
Nevermind I forgot to capitalize Update.