public override void OnInspectorGUI() { _spline = target as CameraPath; _selectedIndex = _spline.GetSelectedPoint(_spline.Time); if (_selectedIndex >= 0 && _spline.IsPathPoint(_selectedIndex)) { _spline.SetPoint(_selectedIndex, _spline.transform.position); _spline.SetRotation(_selectedIndex, _spline.transform.rotation); } EditorGUI.BeginChangeCheck(); _spline.Time = EditorGUILayout.Slider("Time", _spline.Time, 0f, 1f); if (EditorGUI.EndChangeCheck()) { var selection = _spline.GetSelectedPoint(_spline.Time); _selectedIndex = selection; } if (GUILayout.Button("Add Point")) { Undo.RecordObjects(new Object[] { _spline.transform, _spline }, "Add Point"); _spline.AddCurve(); EditorUtility.SetDirty(_spline); } }