AssetDatabase.RefreshSettings

Unity · Версия 2020.3 LTS · Scripting · AssetDatabase

AssetDatabase.RefreshSettings

Объявление

public static void RefreshSettings();

Описание

Применить ожидающие изменения настроек редактора к конвейеру ресурсов.

Немедленно применяет любые изменения свойств EditorSettings для сервера кэширования. Если не вызывается, то изменения этих настроек не вступят в силу, пока вы не перезапустите Редактор.

Список настроек, для применения которых требуется вызов RefreshSettings:

  • EditorSettings.cacheServerNamespacePrefix
  • EditorSettings.cacheServerMode
  • EditorSettings.cacheServerEndpoint
  • EditorSettings.cacheServerEnableTls.
using UnityEngine;
                        using UnityEditor;

                        public class AssetDatabaseExamples : MonoBehaviour

                        {
                        [MenuItem("AssetDatabase/Set Cache Server Project Settings")]
                        static void SetCacheServerProjectSettings()
                        {
                        EditorSettings.cacheServerMode = CacheServerMode.Enabled;
                        Debug.Log("Is Cache Server enabled? - " + AssetDatabase.IsCacheServerEnabled());

EditorSettings.cacheServerEndpoint = "192.168.31.210:10443";
                        Debug.Log("Cache Server IP and Port number: " + AssetDatabase.GetCacheServerAddress() + ":" + AssetDatabase.GetCacheServerPort());

EditorSettings.cacheServerEnableAuth = false;
                        EditorSettings.cacheServerEnableTls = false;

EditorSettings.cacheServerEnableDownload = true;
                        Debug.Log("Is Cache Server download enabled? - " + AssetDatabase.GetCacheServerEnableDownload());

EditorSettings.cacheServerEnableUpload = true;
                        Debug.Log("Is Cache Server upload enabled? - " + AssetDatabase.GetCacheServerEnableUpload());

EditorSettings.cacheServerNamespacePrefix = "default";
                        Debug.Log("Cache Server Namespace prefix: " + AssetDatabase.GetCacheServerNamespacePrefix());

                        //This command is required to apply changes to some of the EditorSettings properties above
                        AssetDatabase.RefreshSettings();
                        }
                        }

Обновлено 17 ноября 2026 г.