There is a slight problem about collider. Lets give a hand pls :)

Hi Everybody,

I have a road on my screen. I created this road from lineRenderer and also added collider to this road.
The player will continue on this road during game but there is problem here because I have “1” road like a string but I have lots of colliders box. So everytime exit from last colliderbox and go into another one.
(when the player exit road, It will be game over.)

How should I controll this situation ?

102877-collider.png

i guess you are using OnColliderExit() for cheking if player is still on the road.

if it is true.

i suggest: don’t dont finish the game at the moment that OnColliderExit called. wait a lite bit to see if player get in an road collider .

let me explain with some pseudo code:

OnTriggerExit() { SetExitTimer }

OnTriggerEnter() { UnSetExitTimer}

when ExitTimer Ran Out , finish the game.