[SOLVED] How to Visualize Raycast2D?

Not sure if I should put this under Scripting or Physics, but here it goes:

I’m having an issue with my raycasting and would like to visualize it to debug it. How would I go about this?

Any help would be greatly appreciated!

– Chris

1 Like
3 Likes

Yes as the link Lumberjack72 posted says you can use Debug.DrawRay() for example like this to display the ray for 10 seconds:
Debug.DrawRay(ray.origin, ray.direction, Color.red, 10.0f);

Then you need to enable Gizmos in the editor to see it.

6 Likes