- Home /
How do I get the current "Highlighted" position?
I need this for a script in Editor Mode.
Basically, when I select an object, and I hold "V", I can "snap" to the closest vertex. The vertex will be highlighted by drawing a gizmo in it.
How can I get the coordinates of that vertex in Editor mode?
Closest vertex on what? Whatever mesh from which you want the closest vertex to position p, sort a copy of the vertex array from the mesh object by distance from p - right?
If I had to implement this myself, I would have to raycast and hit a mesh collider, then get the closest vertex on the collider.
But what I'm trying to achieve should be indipendent from the colliders, and it is also already implemented, since unity has to draw the gizmo somewhere. I thought there might be a way to list the coordinates of the currently drawn gizmos or something like that.
Answer by unimechanic · Nov 07, 2014 at 03:32 PM
The position of the gizmo is stored internally. But you can add a feature request for this information to be exposed:
Your answer
![](https://koobas.hobune.stream/wayback/20220613170715im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Editor Script - Access the User's Snap Settings? 1 Answer
Start/Stop Playmode from editor script 10 Answers
Draw specific Object Inspector into Rect 1 Answer
Editor Window Views 0 Answers
Cancel build in PostProcessScene? 0 Answers