Esempio n. 1
0
        public static void PreferencesGUI()
        {
            if (!PrefsLoaded)
            {
                LoadDefaults();
                PrefsLoaded = true;
            }

            var cache = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 250;
            {
                EditorGUI.BeginChangeCheck();
                GlobalStartUp = (ShowOption)EditorGUILayout.EnumPopup(StartUp, GlobalStartUp);
                if (EditorGUI.EndChangeCheck())
                {
                    EditorPrefs.SetInt(PrefStartUp, (int)GlobalStartUp);
                }
            }

            {
                EditorGUI.BeginChangeCheck();
                GlobalAutoSRP = EditorGUILayout.Toggle(AutoSRP, GlobalAutoSRP);
                if (EditorGUI.EndChangeCheck())
                {
                    EditorPrefs.SetBool(PrefAutoSRP, GlobalAutoSRP);
                }
            }

            {
                EditorGUI.BeginChangeCheck();
                GlobalDefineSymbol = EditorGUILayout.Toggle(DefineSymbol, GlobalDefineSymbol);
                if (EditorGUI.EndChangeCheck())
                {
                    EditorPrefs.SetBool(PrefDefineSymbol, GlobalDefineSymbol);
                    if (GlobalDefineSymbol)
                    {
                        IOUtils.SetAmplifyDefineSymbolOnBuildTargetGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
                    }
                    else
                    {
                        IOUtils.RemoveAmplifyDefineSymbolOnBuildTargetGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
                    }
                }
            }

            {
                EditorGUI.BeginChangeCheck();
                GlobalClearLog = EditorGUILayout.Toggle(ClearLog, GlobalClearLog);
                if (EditorGUI.EndChangeCheck())
                {
                    EditorPrefs.SetBool(PrefClearLog, GlobalClearLog);
                }
            }

            {
                EditorGUI.BeginChangeCheck();
                GlobalUpdateOnSceneSave = EditorGUILayout.Toggle(UpdateOnSceneSave, GlobalUpdateOnSceneSave);
                if (EditorGUI.EndChangeCheck())
                {
                    EditorPrefs.SetBool(PrefUpdateOnSceneSave, GlobalUpdateOnSceneSave);
                }
            }


            {
                EditorGUI.BeginChangeCheck();
                GlobalDisablePreviews = EditorGUILayout.Toggle(DisablePreviews, GlobalDisablePreviews);
                if (EditorGUI.EndChangeCheck())
                {
                    EditorPrefs.SetBool(PrefDisablePreviews, GlobalDisablePreviews);
                    UIUtils.ActivatePreviews(!GlobalDisablePreviews);
                }
            }

#if UNITY_2019_4_OR_NEWER
            EditorGUI.BeginChangeCheck();
            GlobalShowAsyncMsg = EditorGUILayout.Toggle(ShowAsyncMsg, GlobalShowAsyncMsg);
            if (EditorGUI.EndChangeCheck())
            {
                EditorPrefs.SetBool(PrefShowAsyncMsg, GlobalShowAsyncMsg);
            }
#endif
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Reset and Forget All"))
            {
                EditorPrefs.DeleteKey(PrefStartUp);
                GlobalStartUp = ShowOption.Always;

                EditorPrefs.DeleteKey(PrefAutoSRP);
                GlobalAutoSRP = true;

                EditorPrefs.DeleteKey(PrefDefineSymbol);
                GlobalDefineSymbol = true;
                IOUtils.SetAmplifyDefineSymbolOnBuildTargetGroup(EditorUserBuildSettings.selectedBuildTargetGroup);

                EditorPrefs.DeleteKey(PrefClearLog);
                GlobalClearLog = true;

                EditorPrefs.DeleteKey(PrefUpdateOnSceneSave);
                GlobalUpdateOnSceneSave = true;

                EditorPrefs.DeleteKey(PrefDisablePreviews);
                GlobalDisablePreviews = false;

#if UNITY_2019_4_OR_NEWER
                EditorPrefs.DeleteKey(PrefShowAsyncMsg);
                GlobalShowAsyncMsg = true;
#endif
            }
            EditorGUILayout.EndHorizontal();
            EditorGUIUtility.labelWidth = cache;
        }