public override void OnInspectorGUI() { spline = target as BezierSpline; EditorGUI.BeginChangeCheck(); bool loop = EditorGUILayout.Toggle("Loop", spline.Loop); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(spline, "Toggle Loop"); EditorUtility.SetDirty(spline); spline.Loop = loop; } EditorGUI.BeginChangeCheck(); bool autoSetControlPoints = EditorGUILayout.Toggle("Auto Set Control Points", spline.AutoSetControlPoints); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(spline, "Toggle Auto Set Control Points"); EditorUtility.SetDirty(spline); spline.AutoSetControlPoints = autoSetControlPoints; } if (autoSetControlPoints) { EditorGUI.BeginChangeCheck(); float autoSetStrength = EditorGUILayout.FloatField("Strength", spline.AutoSetStrength); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(spline, "Change AutoSet Strength"); EditorUtility.SetDirty(spline); spline.AutoSetStrength = autoSetStrength; } } if (selectedIndex >= 0 && selectedIndex < spline.ControlPointCount) { DrawSelectedPointInspector(); } if (GUILayout.Button("Add Point")) { Undo.RecordObject(spline, "Add Point"); spline.AddPoint(); EditorUtility.SetDirty(spline); } if (selectedIndex % 3 == 0 && selectedIndex > 0) { if (GUILayout.Button("Add Point In Between Points")) { Undo.RecordObject(spline, "Add Curve In Between Points"); spline.AddCurveInBetween(selectedIndex); EditorUtility.SetDirty(spline); } if (GUILayout.Button("Remove Point")) { Undo.RecordObject(spline, "Remove Point"); spline.DeleteAnchorPoint(selectedIndex); EditorUtility.SetDirty(spline); } } }