for some reason this freezes at 1 and wont go down to zero ???
if ( GameManager.Instance.Jump == true)
{
if (timer == 0)
{
timer = 20;
GameManager.Instance.Jump = false;
}
}
if (timer > 0)
{
timer -= 1;
}
Debug.Log(timer);
larku
2
If timer is a float type then you should not use ‘==’ as floats are an approximation and it’s unlikely to ever be exactly 0 when using arithmetic.
Change that to if(timer <= 0)
no difference still doesnt work… even if i change it to a integer there is no diffrence still gets stuck on 1
Because it will overshoot 1 when you add Time.deltaTime so -1 means it will still be over 0. Instead of - 1. change it to timer = 0;
EDIT:
Is that what this timer uses? Time.deltaTime to increment?
1 Like
nope i fixed it hahaha i just had my console set to collapse LOL
1 Like