public override void OnInspectorGUI()
        {
            _spline = target as SplinePath;

            EditorGUI.BeginChangeCheck();
            bool linkMidPoint = EditorGUILayout.Toggle("Link Mid Point", _spline.linkMidPoint);

            if (EditorGUI.EndChangeCheck())
            {
                _spline.linkMidPoint = linkMidPoint;
            }

            if (_selectedIndex >= 0 && _selectedIndex < _spline.ControlPointCount)
            {
                DrawSelectedPointInspector();
            }

            if (GUILayout.Button("Add Curve"))
            {
                Undo.RecordObject(_spline, "Add Curve");
                _spline.AddCurve();
                EditorUtility.SetDirty(_spline);
            }

            if (_spline.ControlPointCount > 4)
            {
                if (GUILayout.Button("Remove Curve"))
                {
                    Undo.RecordObject(_spline, "Remove Curve");
                    _spline.RemoveCurve();
                    EditorUtility.SetDirty(_spline);
                }
            }
        }
        private void OnSceneGUI()
        {
            _spline          = target as SplinePath;
            _handleTransform = _spline.transform;
            _handleRotation  = Tools.pivotRotation == PivotRotation.Local ?
                               _handleTransform.rotation : Quaternion.identity;

            Vector3 p0 = ShowPoint(0);

            for (int i = 1; i < _spline.ControlPointCount; i += 3)
            {
                Vector3 p1 = ShowPoint(i);
                Vector3 p2 = ShowPoint(i + 1);
                Vector3 p3 = ShowPoint(i + 2);

                Handles.color = Color.gray;
                Handles.DrawLine(p0, p1);
                Handles.DrawLine(p1, p2);
                Handles.DrawLine(p2, p3);

                Handles.DrawBezier(p0, p3, p1, p2, Color.white, null, 2f);
                p0 = p3;
            }
        }