Hey, I would like to know how to drop your health down every fifth second.
I’ve figured out that it’s in the update I must fix the script, but how?
Hey, I would like to know how to drop your health down every fifth second.
I’ve figured out that it’s in the update I must fix the script, but how?
Maybe there is a better solution but try this:
private var timeDifference = 0.0;
function Update () {
timeDifference += Time.deltaTime;
if(timeDifference >= 5) {
timeDifference = 0;
DropHealth();
}
}
forgot to mention it is C sharp I’m working in, I’m a beginner so I don’t know if it was c sharp you answered in
HEY! It worked! thanks alot! : D
+1 for correct answer. :) Note you could also use coroutines and yield new WaitForSeconds(5.0) for this.
– CHPedersenThats much easier! :D Thank you for that tip!
– Nonakesh