Health.cs you shouldn't use Time.time to control RegenCanStart. If you do then when you pause the game in the editor, or hit a breakpoint, or even save the game the timer is still going and when you come back regen will start. Rather in OnTakeDamage *set* startRegenTime to timeBetweenDamageAndRegen, then in Update, subtract Time.deltaTime from startRegenTime as long as it's > 0.
Incorrect: Pausing the game (timescale 0) doesn't affect it. Pausing the Game tab from the editor doesn't affect it. Pausing using Debug.Break doesn't affect it. Saving does not affect it. Save a value like "TimeUntilRegenStarts" (value = startRegenTime - Time.time) and upon load do "startRegenTime = Time.time + TimeUntilRegenStarts"
wb
Health.cs you shouldn't use Time.time to control RegenCanStart. If you do then when you pause the game in the editor, or hit a breakpoint, or even save the game the timer is still going and when you come back regen will start. Rather in OnTakeDamage *set* startRegenTime to timeBetweenDamageAndRegen, then in Update, subtract Time.deltaTime from startRegenTime as long as it's > 0.
Incorrect:
Pausing the game (timescale 0) doesn't affect it.
Pausing the Game tab from the editor doesn't affect it.
Pausing using Debug.Break doesn't affect it.
Saving does not affect it. Save a value like "TimeUntilRegenStarts" (value = startRegenTime - Time.time) and upon load do "startRegenTime = Time.time + TimeUntilRegenStarts"