Create one spline from many splines

Hello. I have the following scenario. I’m creating railroad prefabs on a grid. Each prefab has a spline defined. Using the A* algorithm, I select the required prefabs on the grid for the shortest path. Next, I need to create a generic spline from the splines defined in the prefabs. How can I do that? 1) Can I take splines from all prefabs on the path and create one by merging (one spline by merging splines from different spline containers using SplineSlice, SplineRange and SplinePath)? If yes, how is gap between splines filled? How can I visualize this merged spline to debug?

  1. Or is it necessary to take the knots from all prefabs and create one spline? 3) Or create an array of splines from each prefab and move the object over each spline in the array?

Unity 2022.2.17, Spline Package 2.2.1

After some research, I found that spline control points should be set at the edge of the prefab in order for the first approach to work smoothly. It looks like third approach.