Drawing "Ray like" objects in game

Hello again, I’m working on red dot stuff.

I’ve wrote a code for detecting hitdist and etc. but i don’t want to see line. I only want to see where it ends as red dot. how can i do that ?

Check out Remi Gillig’s utility file for drawing debug objects DebugDraw - Unity3D based debug drawing for programmers · GitHub

Works great and no need to clutter your hierarchy with random debug game objects!

If you are looking to only draw something where the ray intersects an object, you can use those utility functions and pass in RaycastHit.point as the position. It is the world position of where the cast hit a specific collider.

Best way might be Graphics.DrawMesh()

Alternately, you could have an actual quad object you keep around, but only activate it when necessary.

Either method requires a texture and material of a red dot. You’d use hit.point to determine the quad’s position in 3D space, probably backing it up by a small amount to avoid z-fighting.