void OnSceneGUI()
        {
            Foliage2D_Path path = (Foliage2D_Path)target;

            GUIStyle iconStyle = new GUIStyle();

            iconStyle.alignment = TextAnchor.MiddleCenter;

            // draw the path line
            if (Event.current.type == EventType.Repaint)
            {
                DrawPath(path);
                if (handleSelected && !path.uniformValues && path.foliagePathType == Foliage2D_PathType.Smooth)
                {
                    DrawTensionBiasLine(index, path);
                }
            }

            // draw and interact with all the path handles
            UpdateHandles(path, iconStyle);

            if (GUI.changed)
            {
                EditorUtility.SetDirty(target);
                path.RecreateFoliage();
            }
        }
        private void CustomInspector(Foliage2D_Path path2D)
        {
            Undo.RecordObject(target, "Modified Inspector");

            showProperties = EditorGUILayout.Foldout(showProperties, "Path Properties");

            if (showProperties)
            {
                EditorGUI.indentLevel = 1;
                InspectorBox(8, () =>
                {
                    path2D.foliagePattern = (Foliage2D_Pattern)EditorGUILayout.EnumPopup(new GUIContent("Foliage Pattern", "Describes how the foliage objects should be arranged on  "
                                                                                                        + "the path lines. Consecutive option will place the foliage objects in a consecutive order while random, in a random order."), path2D.foliagePattern);
                    path2D.foliageOverlapType = (Foliage2D_OverlappingType)EditorGUILayout.EnumPopup(new GUIContent("Overlapping Type", "This popup menu contains two options for how "
                                                                                                                    + " the overlapping factor is calculated. The value of the overlapping factor determines which part of a foliage object mesh will be placed to the left of "
                                                                                                                    + "the right edge of the previous foliage object mesh."), path2D.foliageOverlapType);

                    if (path2D.foliageOverlapType == Foliage2D_OverlappingType.Fixed)
                    {
                        path2D.overlappingFactor = EditorGUILayout.Slider(new GUIContent("Overlapping Factor", "The value of the overlapping factor determines which part of a foliage "
                                                                                         + "object mesh will be placed to the left of the right edge of the previous foliage object mesh."), path2D.overlappingFactor, -2, 0.99f);
                    }
                    else
                    {
                        path2D.minOverlappingFactor = EditorGUILayout.Slider(new GUIContent("Min Overlapping", "The min value for the overlaping factor."), path2D.minOverlappingFactor, -2, 0.99f);
                        path2D.maxOverlappingFactor = EditorGUILayout.Slider(new GUIContent("Max Overlapping", "The max value for the overlaping factor."), path2D.maxOverlappingFactor, -2, 0.99f);
                    }
                    path2D.firstObjectOffset = EditorGUILayout.FloatField(new GUIContent("First Object Offset", "Offsets the distance from the start of the line, where the first object on the current line will be placed."), path2D.firstObjectOffset);
                    path2D.lastObjectOffset  = EditorGUILayout.FloatField(new GUIContent("Last Object Offset", "Offsets the distance from the start of the line, where the last object on the current line will be placed."), path2D.lastObjectOffset);
                    path2D.foliagePathType   = (Foliage2D_PathType)EditorGUILayout.EnumPopup(new GUIContent("Path Type", "Describes how the objects will be placed on the foliage path."), path2D.foliagePathType);

                    if (path2D.foliagePathType == Foliage2D_PathType.Smooth)
                    {
                        path2D.uniformValues = EditorGUILayout.Toggle(new GUIContent("Uniform Values", "When set to true the tension and bias will be the same for all path nodes. "
                                                                                     + "Disable this if you want to change the tension and bias of individual path nodes."), path2D.uniformValues);
                        if (path2D.uniformValues)
                        {
                            path2D.bias    = EditorGUILayout.FloatField(new GUIContent("Bias", "The bias of the path nodes."), path2D.bias);
                            path2D.tension = EditorGUILayout.FloatField(new GUIContent("Tension", "The tension of the path nodes."), path2D.tension);
                        }
                        else
                        {
                            path2D.biasScale    = EditorGUILayout.FloatField(new GUIContent("Bias Scale", "Bias scale"), path2D.biasScale);
                            path2D.tensionScale = EditorGUILayout.FloatField(new GUIContent("Tension Scale", "Tension scale"), path2D.tensionScale);
                        }
                    }

                    path2D.zOffset = EditorGUILayout.FloatField(new GUIContent("Z Offset", "The offset on the Z axis for a foliage object."), path2D.zOffset);
                });
            }
            EditorGUI.indentLevel = 0;

            showFoliagePrefabList = EditorGUILayout.Foldout(showFoliagePrefabList, "Foliage Prefabs");

            if (showProperties)
            {
                EditorGUI.indentLevel = 1;
                InspectorBox(10, () =>
                {
                    path2D.foliagePrefabListSize = Mathf.Clamp(EditorGUILayout.IntField(new GUIContent("Size", "The size of the list that contains the foliage prefabs."), path2D.foliagePrefabListSize), 1, 200);

                    if (path2D.foliagePrefabListSize != path2D.foliagePrefabs.Count)
                    {
                        if (path2D.foliagePrefabListSize > path2D.foliagePrefabs.Count)
                        {
                            while (path2D.foliagePrefabListSize > path2D.foliagePrefabs.Count)
                            {
                                path2D.foliagePrefabs.Add(null);
                            }
                        }
                        else
                        {
                            while (path2D.foliagePrefabListSize < path2D.foliagePrefabs.Count)
                            {
                                int last = path2D.foliagePrefabs.Count - 1;
                                path2D.foliagePrefabs.RemoveAt(last);
                            }
                        }
                    }

                    for (int i = 0; i < path2D.foliagePrefabs.Count; i++)
                    {
                        path2D.foliagePrefabs[i] = EditorGUILayout.ObjectField(new GUIContent("Element " + i), path2D.foliagePrefabs[i], typeof(GameObject), true) as GameObject;
                    }
                });
            }
            EditorGUI.indentLevel = 0;

            if (GUILayout.Button("Clear and Fill"))
            {
                path2D.ClearList();
            }

            if (GUILayout.Button("Center Position"))
            {
                path2D.ReCenterPivotPoint();
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty(target);
                path2D.RecreateFoliage();
            }

            if (Event.current.type == EventType.ValidateCommand)
            {
                switch (Event.current.commandName)
                {
                case "UndoRedoPerformed":
                    path2D.RecreateFoliage();
                    break;
                }
            }
        }