public static void ReadPreferences()
 {
     s_AssetPipelineVersionForNewProjects = (AssetPipelineVersion)EditorPrefs.GetInt(kAssetPipelineVersionForNewProjects, (int)AssetPipelineVersion.Version2);
     s_CacheServer2IPAddress = EditorPrefs.GetString(kIPAddress2Key, s_CacheServer2IPAddress);
     s_CacheServer2Mode      = (CacheServer2Mode)EditorPrefs.GetInt(kMode2Key, (int)CacheServer2Mode.Disabled);
     s_CacheServerIPAddress  = EditorPrefs.GetString(kIPAddressKey, s_CacheServerIPAddress);
     s_CacheServerMode       = (CacheServerMode)EditorPrefs.GetInt(kModeKey, (int)(EditorPrefs.GetBool(kDeprecatedEnabledKey) ? CacheServerMode.Remote : CacheServerMode.Disabled));
     s_LocalCacheServerSize  = EditorPrefs.GetInt(LocalCacheServer.SizeKey, 10);
     s_CachePath             = EditorPrefs.GetString(LocalCacheServer.PathKey);
     s_EnableCustomPath      = EditorPrefs.GetBool(LocalCacheServer.CustomPathKey);
 }
Esempio n. 2
0
        private static void OnGUI(string searchContext)
        {
            EditorGUIUtility.labelWidth = 200f;
            // Get event type before the event is used.
            var eventType = Event.current.type;

            if (!InternalEditorUtility.HasTeamLicense())
            {
                GUILayout.Label(EditorGUIUtility.TempContent("You need to have a Pro or Team license to use the cache server.", EditorGUIUtility.GetHelpIcon(MessageType.Warning)), EditorStyles.helpBox);
            }


            using (new EditorGUI.DisabledScope(!InternalEditorUtility.HasTeamLicense()))
            {
                if (!s_PrefsLoaded)
                {
                    EnsurePreferencesRead();
                    OnPreferencesReadGUI();
                }

                EditorGUI.BeginChangeCheck();

                s_AssetPipelineVersionForNewProjects = (AssetPipelineVersion)EditorGUILayout.EnumPopup(Properties.newProjectsAssetPipeline, s_AssetPipelineVersionForNewProjects);

                EditorGUILayout.LabelField(Properties.activeAssetPipelineVersionLabel, Properties.activeAssetPipelineVersion);
                var  overrideAddress         = GetCommandLineRemoteAddressOverride();
                bool allowCacheServerChanges = overrideAddress == null;

                if (GetEnvironmentAssetPipelineOverride())
                {
                    EditorGUILayout.HelpBox("Asset pipeline currently forced enviroment variable UNITY_ASSETS_V2_KATANA_TESTS", MessageType.Info, true);
                }
                else if (GetCommandLineAssetPipelineOverride() != 0)
                {
                    EditorGUILayout.HelpBox("Asset pipeline currently forced by command line argument", MessageType.Info, true);
                }
                else if (GetMagicFileAssetPipelineOverride())
                {
                    EditorGUILayout.HelpBox("Asset pipeline currently forced by magic adb2.txt file", MessageType.Info, true);
                }

                GUILayout.Space(5);

                CacheServerVersion1GUI(allowCacheServerChanges, overrideAddress);

                GUILayout.Space(5);

                CacheServerVersion2GUI(allowCacheServerChanges, overrideAddress);
                GUILayout.Space(10);

                if (!allowCacheServerChanges)
                {
                    EditorGUILayout.HelpBox("Cache Server preferences currently forced via command line argument to " + overrideAddress + " and any changes here will not take effect until starting Unity without that command line argument.", MessageType.Info, true);
                }

                if (EditorGUI.EndChangeCheck())
                {
                    s_HasPendingChanges = true;
                }

                // Only commit changes when we don't have an active hot control, to avoid restarting the cache server all the time while the slider is dragged, slowing down the UI.
                if (s_HasPendingChanges && GUIUtility.hotControl == 0)
                {
                    s_HasPendingChanges = false;
                    WritePreferences();
                    ReadPreferences();
                }
            }
        }