- Home /
Question by
gabrieltva · Mar 20, 2018 at 05:44 PM ·
c#editoreditor-scripting
How to get the index or position from a Handles.FreeMoveHandle selected?
I have some Handles.FreeMoveHandle in a scene, and I want to know how to get the position or index from a specific Handles.FreeMoveHandle selected.
See this image:
The selected Handle is the yellow. How can I get the position or index from that?
My code to draw is:
Handles.color = Color.red;
EditorGUI.BeginChangeCheck();
Vector3 newPosition = Handles.FreeMoveHandle(position, Quaternion.identity, 10f, Vector3.zero, Handles.CylinderHandleCap);
lastPosition = newPosition;
if (GUI.changed) {
}
if (EditorGUI.EndChangeCheck())
{
currentEdition = index;
Undo.RecordObject(Generator, "position: " + index);
Way[index] = newPosition;
}
But with this, I just can get the index after change the position of a Handle and I want to get when I select it.
captura-de-tela-2018-03-20-as-143440.png
(93.9 kB)
Comment