Unity Cusom Editor Selectable Line

Im making some custom editor, and right now i need an selectable line between two points. I was thinking about just generating it with line renderer or generating a mesh, but before i try that i want to know if there is maybe some already built in feature to make that kind of gizmo/handle/line :slight_smile:

So you just need to render a line in the scene view?

I did that but i need to make that line selectable. So for example when i click on that line it will return me some info.
Right now im using Debug.DrawLine and i know it is not possible to do that with this. Also i tried polyline.

See how this guy in this video made this lines and they are selectable with mouse clicks. Time = 2:22

I think this guy actually wrote his custom handle?

Don’t think he wrote any custom handles… I think he is using the Handles class; Unity - Scripting API: Handles

But i dont see anywhere in documentation that can make Handles.DrawLine or PolyLine selectable or im wrong?

Update: Actually i just got an idea how he did this. I will update comment if i make it.

You can always draw a line and overlap a button on top. Or draw a rect cap very slim from a button.

Yes this actually did a trick. It works just as regular gui button and it can be a line, circle anything. Anyway thanks for your help :slight_smile:

Awesome! I’m just wondering, is it possible to take this to the next level and make a BezierCurve selectable? I’m also writing a custom editor for a spline system.

Perhaps you can divide the bezier curve across multiple segments, and then add a button on each segment.
This might help:

https://www.youtube.com/watch?v=d9k97JemYbM