Closed.
When is unity forums going to add a way to delete posts?
Closed.
When is unity forums going to add a way to delete posts?
Your script is doing 10 damage each interval of HurtDelay. You will need to change Health -= 1; Also make sure HurtDelay is 1.
The issue with your code is you have a infinite loop, OnCollisionStay works like a “update” function, so it will be constantly called each frame.
Remove the while and rather then using wait, just store the previos heal time and check time difference.
If(CurrentTime - lastHealTime >= HurtDelay)
Health -= 1;