Ok, here is the deal… am trying to make an update so for each second I will add 1 point.
My result is that each second I get 6 points…
And why this happens is not because the update runs 6 times like a loop, it is because each line when in the update is running 6 times before going to the next line of code, and it is 6 times and so on.
private float timeLeft = 1.0f;
void Update(){
timeLeft -= Time.deltaTime;
if(timeLeft == 0) //so each second I get inside my if statement...
{
//add score runs 6 times
ScoreCounter.add(1); //debug breakpoints hits here 6 times before going to next line bellow that resets the timer.
//reset timer runs 6 times
timeLeft = 1.0f;
}
}
My issue seems to be totally illogical to me, and can not find anyone having the same problem…
Do someone got answers to this behavior?