// Allow the points to be dragged individually. private Vector3 ShowPoint(int index) { Vector3 point = m_handleTransform.TransformPoint(m_path.GetControlPoint(index)); float size = HandleUtility.GetHandleSize(point); // Keep the handle size constant regardless of view. if (index == 0) { size *= 2f; // Make the first point larger than the rest. } // Show Button Handles for each point. if (Handles.Button(point, m_handleRotation, size * m_handleSize, size * m_pickSize, Handles.DotCap)) { m_selectedIndex = index; Repaint(); // Force the Inspector GUI to refresh. } // Show the Transform Handle for the selected point. if (m_selectedIndex == index) { EditorGUI.BeginChangeCheck(); point = Handles.DoPositionHandle(point, m_handleRotation); if (EditorGUI.EndChangeCheck()) { // Enable Undo for this action. Undo.RecordObject(m_path, "Move Point"); // Let Unity know that a change was made. EditorUtility.SetDirty(m_path); // Update the path's point position in localspace. m_path.SetControlPoint(index, m_handleTransform.InverseTransformPoint(point)); } } return(point); }