- Home /
Endless racing game traffic system
Hi everyone! Hope I posted in the right thread. I'm pretty new at unity development. I've started working on a endless racing game recently and it's been going pretty good until I got to implementing traffic. I am not sure how to handle spawning traffic and making paths since the game generates road randomly out of pre-made tiles. I was thinking maybe add waypoints for traffic on each tile but I'm not sure how that would work because I don't know how to connect them automatically into a path when the tiles spawn and all tutorials and resources I've came upon for now usually use predefined paths and waypoints already present in scene (not possible for my project because). I've tried with Lists which do work for individual tiles but no luck connecting them all together. Each tile prefab has a GameObject with waypoint script which puts all its' children (gameobjects with transforms - acting as waypoints). It works alright and List gets populated with waypoints in order but for each prefab tile only! How would I check for all tiles in the scene and merge all lists together each time tile spawns or despawns? Am I even thinking in the right direction or is there a better solution?
What do you think? Any ideas on how to tackle this problem? If anyone could point me in the right direction I would be extremely grateful!
Your answer
![](https://koobas.hobune.stream/wayback/20220613042246im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
help don't know whats wrong 1 Answer
ai variant of car script 0 Answers
How do go about making "Frogger" traffic? 0 Answers
Pathfinding with Roads 2 Answers
How to implement traffic system efficiently in Unity game to run smoothly on mobile device? 1 Answer