Generating an infinite road from 3 preFabs

Hi, I’m making a runner game, the road is composed of 3 pieces, A,B,C.

To save memory, I’m trying to avoid making a road made from 5000 pieces, and instead, 3 pieces that every-time you finish one, it moves to the next place.

To be more clear, a runner and 3 road pieces that follow it.

Every road has a trigger at the end, this is what calls the function that moves one of the roads to the next position and puts the old one in “Roads space” where it waits to be moved again.

This picture explains how it works:

alt text

I can handle the random choosing, and I can handle the putting back to roads space, however I can’t find a way to put the road in the next position where it should be attached to the current road, because the runner is moving, and the x position is changing :confused:
Please help

Attach it to the end point of the current road by using an empty gameobject placed in the proper connecting/end point position. When the road is to be reattached to the next road, it asks for the endpoint position of the current road, which is just an empty gameObject, this empty object should be a part of the road prefab.