How to display a bezier curve between transforms in-game rather than in editor?

I’m using an iTween path to currently previsualize the flight path of an arrow before it is launched and I would like the player to see this pre-visualization in-game as well.

Is there a way to see the path in-game rather than just using the DrawPath function to see the path in the editor’s scene view?

I thought about the idea of shooting out particles along the same trajectory to previs the path, but I don’t know how to destroy them all when the character changes the trajectory / how to get the particle to instantly draw out the entire flight-path without having to be launched at the same (potentially slow) velocity as my arrow.

Any suggestions?

You can generate a list of points along the curve using iTween.PointOnPath(). The last parameter is the fraction along the path, so you can tune this to create whatever density of points you want. You could even pre-calculate the total distance between the control points and scale the number of points based on the length.

As for drawing the line, you could simply place game objects at your calculated points. If the game objects are non-uniform, you can use Transform.LookAt() to look at the next point in the list to orient them. You could also delay the rendering of each game object based on the fraction it is along the path to get the effect of highlight the path in order.

Note if you want to draw a line (including a dotted line) I highly recommend the Vectrosity (available in the Asset Store).

If you edit an AnimationCurve in Unity, you’ve actually got a Bezier curve, so you may model your curve using this built-in class from unity engine(AnimationCurve) and you can get the “Runtime Curve Editor” from the asset store, with that you can visually edit in-game such curves, the source code is also available with that package ,that in the case you only want to extract the code for drawing a bezier curve in-game(at runtime) .
Check this out :