removing numbers after time

by using "Health -= 1;" in javascript i can take 1 away from health if a certain need is met... but how do i make it take one away every second... thanks :)

2 Answers

2

Use InvokeRepeating.

To expand on what efge said:

health -= Time.deltaTime

Will reduce the health by one unit per second, but it's not rounding to integer values. I'm not sure if you want to do a health bar, or have rounded numbers or not, you didn't really say.