/// <summary>
        /// Create a New BrushSettings Asset
        /// </summary>
        /// <returns>the newly created BrushSettings</returns>
        internal static BrushSettings AddNew(BrushSettings prevSettings = null)
        {
            string path = PolyEditorUtility.UserAssetDirectory + "Brush Settings";

            if (string.IsNullOrEmpty(path))
            {
                path = "Assets";
            }

            path = AssetDatabase.GenerateUniqueAssetPath(path + "/New Brush.asset");

            if (!string.IsNullOrEmpty(path))
            {
                BrushSettings settings = ScriptableObject.CreateInstance <BrushSettings>();
                if (prevSettings != null)
                {
                    string name = settings.name;
                    prevSettings.CopyTo(settings);
                    settings.name = name;       // want to retain the unique name generated by AddNew()
                }
                else
                {
                    settings.SetDefaultValues();
                }

                AssetDatabase.CreateAsset(settings, path);
                AssetDatabase.Refresh();

                EditorGUIUtility.PingObject(settings);

                return(settings);
            }

            return(null);
        }
        void DrawBrushSettings()
        {
            // Brush preset selector
            using (new GUILayout.VerticalScope("box"))
            {
                // Show the settings header in PolyEditor so that the preset selector can be included in the block.
                // Can't move preset selector to BrushSettingsEditor because it's a CustomEditor for BrushSettings,
                // along with other issues.
                if (PolyGUILayout.HeaderWithDocsLink(PolyGUI.TempContent("Brush Settings")))
                {
                    Application.OpenURL(PrefUtility.documentationBrushSettingsLink);
                }

                using (new GUILayout.HorizontalScope())
                {
                    EditorGUI.BeginChangeCheck();

                    m_CurrentBrushIndex = EditorGUILayout.Popup(m_CurrentBrushIndex, m_AvailableBrushesStrings, "Popup");

                    if (EditorGUI.EndChangeCheck())
                    {
                        if (m_CurrentBrushIndex >= m_AvailableBrushes.Count)
                        {
                            SetBrushSettings(BrushSettingsEditor.AddNew(brushSettings));
                        }
                        else
                        {
                            SetBrushSettings(m_AvailableBrushes[m_CurrentBrushIndex]);
                        }
                    }

                    if (GUILayout.Button(m_GCSaveBrushSettings, GUILayout.Width(40)))
                    {
                        if (brushSettings != null && brushSettingsAsset != null)
                        {
                            // integer 0, 1 or 2 corresponding to ok, cancel and alt buttons
                            int res = EditorUtility.DisplayDialogComplex("Save Brush Settings", "Overwrite brush preset, or Create a New brush preset? ", "Overwrite", "Create New", "Cancel");

                            if (res == 0)
                            {
                                brushSettings.CopyTo(brushSettingsAsset);
                                EditorGUIUtility.PingObject(brushSettingsAsset);
                            }
                            else if (res == 1)
                            {
                                BrushSettings dup = BrushSettingsEditor.AddNew(brushSettings);
                                SetBrushSettings(dup);
                                EditorGUIUtility.PingObject(brushSettingsAsset);
                            }
                        }
                        else
                        {
                            Debug.LogWarning("Something went wrong saving brush settings.");
                        }
                    }
                }
                EditorGUI.BeginChangeCheck();

                brushEditor.OnInspectorGUI();
            }
        }