Endless runner spawing platform spawns too many and too far apart. Help with code please?
Hi, I'm making a 3d endless tunnel runner and I wrote some code to spawn 10 environment/tunnel prefabs which are destroyed after 3 seconds the player steps off them. However, when I run the game, too many prefabs are spawned and they are spaced out after the first 10, resulting in the player character falling off. I'm designing the game so that the player stays in the same spot and environment comes towards them. I am learning coding so I appologise if it is messy. I've attached the code below. Thanks in advance.
Your answer
![](https://koobas.hobune.stream/wayback/20220613055736im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Moving left and right with one button in 2d Game 1 Answer
How to automatically generate a new int with a specific name? 1 Answer
Unity Photon Next Step? 0 Answers
How to spawn randomly with multiple gameobject 2 Answers
Making a high score script 0 Answers