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;
}