SaveFilePanelInProject() public static method

Displays the "save file" dialog in the Assets folder of the project and returns the selected path name.

public static SaveFilePanelInProject ( string title, string defaultName, string extension, string message ) : string
title string
defaultName string
extension string
message string
return string
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            var t = (LocalizationManager)target;

            if (GUILayout.Button("Generate default database"))
            {
                var path = EditorUtility.SaveFilePanelInProject("Save file", "MainLanguageDb.asset", "asset", "Choose a location where to save the localization database.");
                if (path.EndsWith(".asset"))
                {
                    int indexOf = path.LastIndexOf(Path.DirectorySeparatorChar);
                    if (indexOf == -1)
                    {
                        indexOf = path.LastIndexOf('/');
                    }

                    path = path.Substring(0, indexOf);
                }

                if (string.IsNullOrEmpty(path) == false)
                {
                    var asset     = ScriptableObjectUtility.CreateAsset <LocalizationDatabase>(path, "MainLanguageDb.asset");
                    var defaultDb = typeof(LocalizationManager).GetField("_defaultDatabase", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
                    defaultDb.SetValue(t, asset);

                    var databases = typeof(LocalizationManager).GetField("_databases", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
                    var dbList    = ((LocalizationDatabase[])databases.GetValue(t)).ToList();
                    dbList.Add(asset);

                    databases.SetValue(t, dbList.ToArray());
                }
            }

            if (GUILayout.Button("Open Localization Editor"))
            {
                LocalizationEditorWindow.ShowWindow();
            }
        }