public override void OnInspectorGUI()
{
EditorGUI.BeginChangeCheck();
bool loop = EditorGUILayout.Toggle("Loop", spline.Loop);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(spline, "Toggle Loop");
EditorUtility.SetDirty(spline);
spline.Loop = loop;
}
if (selectedIndex >= 0 && selectedIndex < spline.ControlPointCount)
{
DrawSelectedPointInspector();
}
if (GUILayout.Button("Add Curve Point"))
{
Undo.RecordObject(spline, "Add Curve Point");
if (selectedIndex == spline.ControlPointCount - 1)
{
spline.AddCurve();
}
else if (selectedIndex % 3 == 0)
{
spline.AddCurve(selectedIndex);
}
EditorUtility.SetDirty(spline);
}
}