Is there a way to draw particles on a raycast?

In my game one ability uses a raycast to determine where the shot hits. Is there any way to draw a trail along the raycast? Can I spawn particles along certain intervals on the raycast?

Vector3.Lerp or Vector3.MoveTowards are what you want here.
Take your current position and the point your ray hits and move towards it and instantiate an object at each step.


float step = 1f / numberOfObjectsIWant;
float currentStep = 0;
for( int i = 0; i < numberOfObjectsIWant; ++i )
    currentStep += step;
    Vector3 position = Vector.Lerp( whereIAm, whereMyRaycastHit, currentStep );
    // Create object at position 

I am trying to do the same thing! But, I am not much of a coder, I am more of a designer and have been using playmaker for VR. Could you guys help me at all with how I would do this, I am guessing I can not just drag and drop that code as a script?