UnityEditor.CacheServerPreferences.ReadPreferences C# (CSharp) Method

ReadPreferences() public static method

public static ReadPreferences ( ) : void
return void
        public static void ReadPreferences()
        {
            s_CacheServerIPAddress = EditorPrefs.GetString("CacheServerIPAddress", s_CacheServerIPAddress);
            s_CacheServerMode = (CacheServerMode) EditorPrefs.GetInt("CacheServerMode", !EditorPrefs.GetBool("CacheServerEnabled") ? 2 : 1);
            s_LocalCacheServerSize = EditorPrefs.GetInt("LocalCacheServerSize", 10);
            s_CachePath = EditorPrefs.GetString("LocalCacheServerPath");
            s_EnableCustomPath = EditorPrefs.GetBool("LocalCacheServerCustomPath");
            if (IsCollabCacheEnabled())
            {
                s_CollabCacheIPAddress = EditorPrefs.GetString("CollabCacheIPAddress", s_CollabCacheIPAddress);
                s_CollabCacheEnabled = EditorPrefs.GetBool("CollabCacheEnabled");
            }
        }

Usage Example

 public static void OnGUI()
 {
     GUILayout.Space(10f);
     if (!InternalEditorUtility.HasPro())
     {
         GUILayout.Label(EditorGUIUtility.TempContent("You need to have a Pro license to use the cache server.", EditorGUIUtility.GetHelpIcon(MessageType.Warning)), EditorStyles.helpBox, new GUILayoutOption[0]);
     }
     EditorGUI.BeginDisabledGroup(!InternalEditorUtility.HasPro());
     if (!CacheServerPreferences.s_PrefsLoaded)
     {
         CacheServerPreferences.ReadPreferences();
         CacheServerPreferences.s_PrefsLoaded = true;
     }
     EditorGUI.BeginChangeCheck();
     CacheServerPreferences.s_CacheServerEnabled = EditorGUILayout.Toggle("Use Cache Server", CacheServerPreferences.s_CacheServerEnabled, new GUILayoutOption[0]);
     EditorGUI.BeginDisabledGroup(!CacheServerPreferences.s_CacheServerEnabled);
     CacheServerPreferences.s_CacheServerIPAddress = EditorGUILayout.TextField("IP Address", CacheServerPreferences.s_CacheServerIPAddress, new GUILayoutOption[0]);
     if (GUI.changed)
     {
         CacheServerPreferences.s_ConnectionState = CacheServerPreferences.ConnectionState.Unknown;
     }
     GUILayout.Space(5f);
     if (GUILayout.Button("Check Connection", new GUILayoutOption[]
     {
         GUILayout.Width(150f)
     }))
     {
         if (InternalEditorUtility.CanConnectToCacheServer())
         {
             CacheServerPreferences.s_ConnectionState = CacheServerPreferences.ConnectionState.Success;
         }
         else
         {
             CacheServerPreferences.s_ConnectionState = CacheServerPreferences.ConnectionState.Failure;
         }
     }
     GUILayout.Space(-25f);
     CacheServerPreferences.ConnectionState connectionState = CacheServerPreferences.s_ConnectionState;
     if (connectionState != CacheServerPreferences.ConnectionState.Success)
     {
         if (connectionState == CacheServerPreferences.ConnectionState.Failure)
         {
             EditorGUILayout.HelpBox("Connection failed.", MessageType.Warning, false);
         }
     }
     else
     {
         EditorGUILayout.HelpBox("Connection successful.", MessageType.Info, false);
     }
     EditorGUI.EndDisabledGroup();
     if (EditorGUI.EndChangeCheck())
     {
         CacheServerPreferences.WritePreferences();
         CacheServerPreferences.ReadPreferences();
     }
     EditorGUI.EndDisabledGroup();
 }
All Usage Examples Of UnityEditor.CacheServerPreferences::ReadPreferences