Time Trial & Ghosting

Is there a way to make a Time trial for a car game?

as in there is a set course time and you have to beat it, if you do, your time becomes the course time, after the first run your run is ghosted

by ghosted i mean what you did is replayed on the track with an opaque no collision version of your car like the one in this video http://www.youtube.com/watch?v=ACHtQRJcyqU

Sure. Just sample the position of your car each FixedUpdate and if your run is the fastet save this array or list permanently. On the next run use these positions to move the "ghost car". You may get away with less than one sample per FixedUpdate and interpolating the other positions. However this is a very basic approach, as this won't show skidmarks, turning or steering wheels etc.. To achieve this you'd have to save more data than just the positions.

You could also try to just save the user input and move the ghost car according to that, but as this can be very inaccurate (frames out of sync rounding errors etc.) you'd need to take a few data samples to get the car "back on track" anyway.