private void OnEnable() //EN CASO DE QUE PIERDA REFS AL RECARGAR
        {
            if (databaseRef == null)
            {
                databaseRef = CustomIconsDrawer.GetDatabase();
            }

            databaseIndex = databaseRef.ContainsGUID(selectedGUID);
            if (databaseIndex != -1)
            {
                databaseRef.SetName(databaseIndex, selectedObj.name);
            }
        }
 private static void CheckFirstUse()
 {
     EditorApplication.update -= CheckFirstUse;
     if (!CustomIconsPref.ConfigPathIsSet)
     {
         string defaultPath = CustomIconsDrawer.TryFindDefaultDatabase();
         if (defaultPath != "")
         {
             CustomIconsPref.SaveConfigPath(defaultPath);
         }
         CreateWindow();
     }
     else
     {
         if (!CustomIconsDrawer.FindDatabaseReference())
         {
             EditorUtility.DisplayDialog("Custom Icons Error", "No se encuentra el archivo de configuración, ¿movió las carpetas del plugin CustomIcons?\n" +
                                         "Configure nuevamente la ruta de configuración en Edit->Preferences->CustomIcons", "Ok");
         }
     }
 }
        static public void CustomIconsPrefGUI()
        {
            GUILayout.Label("Config file", EditorStyles.boldLabel);

            if (ConfigPathIsSet && configPath != CurrentConfigPath)
            {
                configPath = CurrentConfigPath;
            }

            GUILayout.Label(configPath, EditorStyles.helpBox);

            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Load File"))
            {
                string filePath;

                if (configPath != "")
                {
                    string openAtPath = Application.dataPath.Replace("Assets", "") + configPath;
                    openAtPath = Path.GetDirectoryName(openAtPath);
                    filePath   = EditorUtility.OpenFilePanel("Create Custom Icons config file", openAtPath, "asset");
                }
                else
                {
                    filePath = EditorUtility.OpenFilePanel("Create Custom Icons config file", Application.dataPath, "asset");
                }

                if (filePath == "")
                {
                    return;
                }

                string assetPath = "Assets" + filePath.Split(new string[1] {
                    "Assets"
                }, System.StringSplitOptions.None)[1];

                configPath = assetPath;
                SaveConfigPath(configPath);
                CustomIconsDrawer.FindDatabaseReference();
            }

            if (GUILayout.Button("Create File"))
            {
                string filePath;

                if (configPath != "")
                {
                    string openAtPath = Application.dataPath.Replace("Assets", "") + configPath;
                    openAtPath = Path.GetDirectoryName(openAtPath);
                    filePath   = EditorUtility.SaveFilePanelInProject("Create Custom Icons config file", "CustomIconsConfig", "asset", "Select or create a new config file", openAtPath);
                }
                else
                {
                    filePath = EditorUtility.SaveFilePanelInProject("Create Custom Icons config file", "CustomIconsConfig", "asset", "Select or create a new config file", Application.dataPath);
                }

                if (filePath == "")
                {
                    return;
                }

                CustomIconsDatabase file = (CustomIconsDatabase)AssetDatabase.LoadAssetAtPath(filePath, typeof(CustomIconsDatabase));
                if (file == null)
                {
                    file = ScriptableObject.CreateInstance <CustomIconsDatabase>();
                    AssetDatabase.CreateAsset(file, filePath);
                    AssetDatabase.Refresh();
                }

                configPath = filePath;
                SaveConfigPath(configPath);
                CustomIconsDrawer.FindDatabaseReference();
            }

            GUILayout.EndHorizontal();

            if (GUILayout.Button("ERASE PREFS"))
            {
                if (EditorUtility.DisplayDialog("Borrando configuración", "¿Está seguro que desea borrar la configuración de este proyecto? Esta operación es irreversible.", "Sí", "No"))
                {
                    EraseConfigPath();
                    configPath = "";
                }
            }
        }