Making a raycast visible

I have a ray that I would like to make that cast a solid line that the camera can see. Thank you!!

Depends what you need it for, if it’s only for debug purposes, you can use Debug.DrawLine and draw a line from the raycast start to the hit position.

If you need the line in game, you can use the LineRenderer, jsut read up on it, it’s quite easy to implement. Also, check out these awesome examples.

You can use Debug.DrawRay like this . And let me know if you got any problem with understanding the code I will try my best to help you . :slight_smile:
if(Physics.Raycast(transform.position,transform.forward,out hit)) { if (hit.collider.gameObject.tag == "Tagged") { Debug.DrawRay(transform.position, transform.forward, Color.green); print("Hit"); } }

You could use a line renderer in combination with your raycast.
http://docs.unity3d.com/Manual/class-LineRenderer.html

7 years late to the party lol, but I just was trying to do the same thing and I found this short video tutorial to be perfect Unity 43 - RaycastHit with LineRenderer - YouTube