- Home /
Infinte Runner 2D - how to generate floor and obstacles?
Hey folks,
I'm working on my 2D Infinite Runner, and now I'm trying to work out how to generate a more random floor and how to to randomly spawn obstacles on the floor. The difference to the 2D Inifinite Runner Tutorial from the Learn section is that I don't want the character to run on seperate platforms which spawn on different heights, I want to have one consistent floor with gaps only spawning from time to time but with "natural" height changes. For this I created different short parts of floor for 3 different levels (low, mid, high) and respective transitions. Now my question is, how may I control that a transition spawns before or after a levelchange? Annnnd, the second question: how could I control that obstacles don't spawn above gaps, and that collectable objects don't spawn "inside" of obstacles or the ground? Thanks in advance!
Your answer
![](https://koobas.hobune.stream/wayback/20220613181955im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Trouble with Navmesh Agent and Navmesh Obstacle 0 Answers
Toggling NavMeshAgent and NavMeshObstacle 2 Answers
Remove old Objects in scene 1 Answer
Navmesh carving causing issues upon enabling navmesh agent component 0 Answers
The right way to generate levels like Knife Hit or Paint hit game style. 1 Answer