Beispiel #1
0
        private static void XamlC(string search)
        {
            EditorGUI.BeginChangeCheck();

            using (new SettingsGUILayout.IndentedGroup("XamlC"))
            {
                OptimizeIL.value   = SettingsGUILayout.SettingsToggle("Optimize IL", OptimizeIL, search);
                DebugSymbols.value = SettingsGUILayout.SettingsToggle("Debug Symbols", DebugSymbols, search);
            }

            if (EditorGUI.EndChangeCheck())
            {
                Backend.Save();
            }
        }
        void DoContextMenu()
        {
            var menu = new GenericMenu();

            menu.AddItem(new GUIContent("Reset All"), false, () =>
            {
                if (!UnityEditor.EditorUtility.DisplayDialog("Reset All Settings", "Reset all settings? This is not undo-able.", "Reset", "Cancel"))
                {
                    return;
                }

                // Do not reset SettingVisibility.Unregistered
                foreach (var pref in UserSettings.FindUserSettings(m_Assemblies, SettingVisibility.Visible | SettingVisibility.Hidden | SettingVisibility.Unlisted))
                {
                    pref.Reset();
                }

                m_SettingsInstance.Save();
            });

            if (EditorPrefs.GetBool("DeveloperMode", false))
            {
                menu.AddSeparator("");

                menu.AddItem(new GUIContent("Developer/List Settings By Key"), listByKey, () =>
                {
                    listByKey.SetValue(!listByKey, true);
                    SearchForUserSettingAttributes();
                });

                menu.AddSeparator("Developer/");

                menu.AddItem(new GUIContent("Developer/Show User Settings"), showUserSettings, () =>
                {
                    showUserSettings.SetValue(!showUserSettings, true);
                    SearchForUserSettingAttributes();
                });

                menu.AddItem(new GUIContent("Developer/Show Project Settings"), showProjectSettings, () =>
                {
                    showProjectSettings.SetValue(!showProjectSettings, true);
                    SearchForUserSettingAttributes();
                });

                menu.AddSeparator("Developer/");

                menu.AddItem(new GUIContent("Developer/Show Unlisted Settings"), showHiddenSettings, () =>
                {
                    showHiddenSettings.SetValue(!showHiddenSettings, true);
                    SearchForUserSettingAttributes();
                });

                menu.AddItem(new GUIContent("Developer/Show Unregistered Settings"), showUnregisteredSettings, () =>
                {
                    showUnregisteredSettings.SetValue(!showUnregisteredSettings, true);
                    SearchForUserSettingAttributes();
                });

                menu.AddSeparator("Developer/");

                menu.AddItem(new GUIContent("Developer/Open Project Settings File"), false, () =>
                {
                    var project = m_SettingsInstance.GetRepository(SettingsScope.Project);

                    if (project != null)
                    {
                        var path = Path.GetFullPath(project.path);
                        System.Diagnostics.Process.Start(path);
                    }
                });

                menu.AddItem(new GUIContent("Developer/Print All Settings"), false, () =>
                {
                    Debug.Log(UserSettings.GetSettingsString(m_Assemblies));
                });

#if UNITY_2019_1_OR_NEWER
                menu.AddSeparator("Developer/");
                menu.AddItem(new GUIContent("Developer/Recompile Scripts"), false, UnityEditorInternal.InternalEditorUtility.RequestScriptReload);
#endif
            }

            menu.ShowAsContext();
        }