private void DrawHandles() { for (int i = 0; i < Point.Waypoints.Count; i++) { Handles.color = Point.LineColors; if (Handles.Button(Point.CalculateMidPoint(i), Quaternion.identity, 1f, 1f, Handles.SphereHandleCap)) { Point.Insert(i); } } serializedTarget.Update(); for (int i = 0; i < PointList.arraySize; i++) { if (i > 0) { PointList.GetArrayElementAtIndex(i).vector3Value = Handles.PositionHandle(Point.Waypoints[i], Quaternion.identity); } else { PointList.GetArrayElementAtIndex(i).vector3Value = Point.transform.position; } } serializedTarget.ApplyModifiedProperties(); }