版本:Unity 6(6000.0)
语言英语
  • C#

AssetDatabase.GetCacheServerNamespacePrefix

提出更改

成功!

感谢你帮助我们改进 Unity 文档的质量。尽管我们无法接受所有提交,但我们确实会阅读用户提出的每个建议更改,并在适用时进行更新。

关闭

提交失败

由于某种原因,无法提交你建议的更改。请在几分钟后重试。感谢你花时间帮助我们改进 Unity 文档的质量。

关闭

取消

声明

public static string GetCacheServerNamespacePrefix();

返回

string 返回缓存服务器的命名空间前缀。

说明

获取在编辑器设置中设置的缓存服务器命名空间前缀。

注意:如果你为命名空间前缀设置了新值,则在调用 AssetDatabase.RefreshSettings() 之前不会应用你的新设置。但是,无论你是否应用设置,此方法都会返回你设置的值。

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(); } }