

If (stripsCurrentIndex > indexOfTheHighestRoadStrip) GameObject newStrip = Instantiate (item,, ) as GameObject GameObject lastStrip = strips as GameObject Transform itemChildOfChildTranform = itemChildTransform.GetChild (0) as Transform įloat itemWidth = (). Transform itemChildTransform = (0) as Transform GameObject item = poolOfStripsPrefabs as GameObject Int randomNumber = Random.Range (0, stripsPrefabCount)

Int stripsPrefabCount = poolOfStripsPrefabs.Length I tried to destroy the next lane when the player hit an obstacle and tried to cancel the movement, but its sens to crash or bug the game. Basically, when the player hit an obstacle going up, the game generates a lane, its ok, the problem is: if he hit the obstacle 3 times, go to the side and jump up without hitting an obstacle, the player will jump 4 lanes instead of 1.
