private void OnTriggerStay2D(Collider2D collision)
{
timeee += Time.deltaTime;
}
private void OnTriggerExit2D(Collider2D collision)
{
timeee = 0;
}
What I am trying to do is; incrementing the timeee variable every second until any object starts touching the trigger until it stops touching. And when it’s 7 seconds to finish the game. I wrote the code as in the picture. However, the code starts counting but stops counting after a while.
As you can see, it touches the trigger, but the timeee variable does not increase after a point. When another object touches it, it starts to increase again.