Manually unselect a handle in the editor from a script
Hi everyone,
My question is simple, is there a way to unselect the actual selected handle in the editor using some code ?
(Here is what I have)
chunk.G.ControlPoints.ForEach(cp =>
{
cp.Position = Handles.PositionHandle(cp.Position, Quaternion.identity);
Vector3 pos = Vector3.Lerp(cp.Position,
cp.GetNeighbour(ControlPoint.e_Side.LeftNode).Position, 0.5f);
float size = HandleUtility.GetHandleSize(pos) * 0.2f;
EditorGUI.BeginChangeCheck();
Vector3 newTargetPosition = Handles.FreeMoveHandle(pos,
Quaternion.identity, size, Vector3.one * 0.5f, Handles.CircleHandleCap);
if (EditorGUI.EndChangeCheck())
{
chunk.CreateNewControlPoint(cp);
}
});
Basically, I've got control points I can move using the PositionHandle. Between two control points there is an other Handle, this handle is used to create a new control point if the user moves it.
What actually happens is that it creates a LOT of new control points since the same handle is dragged without getting unselected.
What I want to achieve is to automatically select the new control point's PositionHandle after it was created. Is it possible ?
Your answer
Follow this Question
Related Questions
Handles.ScaleHandle gizmo gui does not move? 0 Answers
Do Unity Editor GUI Utilities (Handles.DrawLine & EditorGUI.DrawRect) have limitations? 2 Answers
Select GameObjects OnSceneView without Colliders 1 Answer
How do I execute code while dragging an ArcHandle? 0 Answers
How to change the text of EditorGUILayout.TextField 2 Answers