Railroad Track Connector/Renderer

I greet the community!

I am currently tasked with writing a small game, that involves randomly generated train tracks.
The player looks at the game from a top down perspective.

The challenge that faces me now:
How do I optimally connect/display those tracks on a generated path?
What base resource do I use?
Models which I mutate/modify to create curves & junctions?
Or rather fixed parts that I stick together?
I can do the coding part, that’s no problem. I just need a best-practice advice here.

I also gladly will use any Asset that takes the job off of me;
But I have so far only found one train track package that does not let me generate tracks in real time - only inside the Editor.

I am very thankful about any help given to me,
and I wish all of you a nice day!

Depends on the kind of the game. If it’s tile-based, then you only need to mark some fields in a grid as train tracks and visually put the right tile there, based on its neighbors. If the track should be a bit more flexible, you can save start- and endpoints of each segment and possibly a couple points inbetween for turns, and then put a texture around it to visualize the train tracks, similar to how it’s being done in this path tool by Sebastian Lague:

Since train tracks can be a bit more complicated than one line, you would need to handle junctions separately, but the idea should be similar. Get the directions of the tracks and calculate a mesh / track texture that makes sense.

How do you generate your paths? In the end you want to use that data and build a visualization around it. For a line it’s comparably easy, as you should be able to copy what is being done in the video. For junctions you probably need to handle the mesh a bit differently, but depending on how you generate your paths it may also be quick to implement.

Hope this helps a bit