Tiling problem: how to know where to put next tile?

I’m trying to create a walkway in a random fashion where the tiles spawn one after another. The length I have figured out how to tile correctly but I’m having problems with where the next tile should be set on the x.axis (the ‘width’).
Lets take the 3D object below as an example.

If I want to connect this object with another in the bottom left corner (to make a continous walkway), what would be the best way to go about this? This is the first time I have been playing around with bounds but can’t get that to work. Is there a way to get the length of the collider in just that part? Is raycasting the prefered way here?

Any help in getting my head around this is much appreciated.

Cheers,
RG

One option is to mark the start and end of each tile. Do this by creating two empty GameObject children for each tile. Position one at the beginning. Rotate so its forward is into the tile. Position another at the end. Rotate so its forward is out of the tile. To connect the tiles, you just need to align the start of the next tile with the end of the last, and rotate it so that the two markers are facing the same way. Save this as a prefab for each tile in your tile set, and then add something like this to your tile script:

public Transform start;
public Transform end;

//This would get called shortly after instantiation to align it with the previous tile.
void Connect (Tile prev) {
    transform.position = new Vector3(0, 0, 0);
    transform.rotation = transform.rotation * (start.rotation.Inverse * prev.end.rotation);
    transform.position = prev.end.position - start.position;
}