Noah-1
1
Hello gentlemen well I have some troubles counting an event:
var eventCount: int = 0;
if(Player.transform.position.y < - 5){
eventCount++;
}
If my player falls to -5, my variable eventCount its suposed to go up to 1 but
it goes to 2.
Any ideas on how to solve that?
Joshua
2
Add a timeout before it can add again?
system
3
It is a little difficult to ascertain what you want from that section of code.
Unless you are processing the event instantly the eventCount will increment every frame that your transform position is less than -5... that could be 1000 times a second. So as Joshua answered, adding a timeout before you can increment eventCount again will probably fix your issue.
Also I don't know if it was a typo in your question or an unnoticed error in your code but:
var eventount: int = 0;
should be
var eventCount: int = 0;