/// <summary> /// Removes a control point and its data. /// </summary> /// <param name="controlId"></param> public void RemoveDragPoint(int controlId) { var idx = ControlPoints.FindIndex(controlPoint => controlPoint.ControlId == controlId); if (idx < 0) { return; } var removalOk = !ControlPoints[idx].DragPoint.IsLocked; if (!removalOk) { removalOk = EditorUtility.DisplayDialog("Locked DragPoint Removal", "This drag point is locked!\nAre you really sure you want to remove it?", "Yes", "No"); } if (!removalOk) { return; } var dragPoints = DragPointInspector.DragPoints.ToList(); dragPoints.RemoveAt(idx); DragPointInspector.DragPoints = dragPoints.ToArray(); RebuildControlPoints(); }