Easy way to make ordered node system

  1. What do you want to achieve?
    I want an easier way to lay track for a node based train system, whether it be a script or a better manual way

  2. What is the issue?
    With the current setup i have to lay out the path, then one by one set an object value in each piece to pick the next part, which is very slow since a single route can have hundreds of nodes

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Tried rewriting a plugin to rename them in order, but realized it wont work

Looking for a good way to speed this process up

You could shoot a ray in directions of left/right (towards other objects and in the direction you want the next part to be in), if something got hit and is close enough, and has all the other instances inside set the value to it, if not, skip for now.

You might need to look into the opposite direction from where the next object should be as when you create an object, the one after it isn’t yet there so when it spawns, it sets the value of the one before it to it.

You can also save them as an array then set the value of the last element in the array to the new one, then insert the new one.