public static void WritePreferences() { // Don't change anything if there's a command line override if (GetCommandLineRemoteAddressOverride() != null) { return; } CacheServerMode oldMode = (CacheServerMode)EditorPrefs.GetInt(kModeKey); var oldPath = EditorPrefs.GetString(LocalCacheServer.PathKey); var oldCustomPath = EditorPrefs.GetBool(LocalCacheServer.CustomPathKey); bool changedDir = false; if (oldMode != s_CacheServerMode && oldMode == CacheServerMode.Local) { changedDir = true; } if (s_EnableCustomPath && oldPath != s_CachePath) { changedDir = true; } if (s_EnableCustomPath != oldCustomPath && s_CachePath != LocalCacheServer.GetCacheLocation() && s_CachePath != "") { changedDir = true; } if (changedDir) { s_LocalCacheServerUsedSize = -1; var message = s_CacheServerMode == CacheServerMode.Local ? "You have changed the location of the local cache storage." : "You have disabled the local cache."; message += " Do you want to delete the old locally cached data at " + LocalCacheServer.GetCacheLocation() + "?"; if (EditorUtility.DisplayDialog("Delete old Cache", message, "Delete", "Don't Delete")) { LocalCacheServer.Clear(); s_LocalCacheServerUsedSize = -1; } } EditorPrefs.SetInt(kAssetPipelineVersionForNewProjects, (int)s_AssetPipelineVersionForNewProjects); EditorPrefs.SetString(kIPAddress2Key, s_CacheServer2IPAddress); EditorPrefs.SetInt(kMode2Key, (int)s_CacheServer2Mode); EditorPrefs.SetString(kIPAddressKey, s_CacheServerIPAddress); EditorPrefs.SetInt(kModeKey, (int)s_CacheServerMode); EditorPrefs.SetInt(LocalCacheServer.SizeKey, s_LocalCacheServerSize); EditorPrefs.SetString(LocalCacheServer.PathKey, s_CachePath); EditorPrefs.SetBool(LocalCacheServer.CustomPathKey, s_EnableCustomPath); LocalCacheServer.Setup(); if (AssetDatabase.IsV2Enabled()) { AssetDatabaseExperimental.RefreshConnectionToCacheServer(); } if (changedDir) { //Call ExitGUI after bringing up a dialog to avoid an exception EditorGUIUtility.ExitGUI(); } }
public void OnDisable() { DevDeviceList.Changed -= OnDeviceListChanged; if (AssetDatabase.IsV2Enabled()) { AssetDatabaseExperimental.RefreshCacheServerNamespacePrefix(); AssetDatabaseExperimental.RefreshConnectionToCacheServer(); } }