unity-部署CacheServer

来源:互联网 发布:国籍 知乎 编辑:程序博客网 时间:2024/06/09 23:32

官网文档:https://docs.unity3d.com/Manual/CacheServer.html?
用来缓存不同平台资源,否则每当切换不同平台打包资源时会耗费很多时间。一般用于 打包机。


启动 Cache Server 服务

  • 下载并解压 CacheServer-5.6.1f1.zip,下载对应版本的 Cache Server,传送门:https://unity3d.com/cn/get-unity/download/archive

  • 运行

    ./RunOSX.command --path ~/unity_cache_server/CacheAssets --port 10241 --size 10000000000 --nolegacy

    成功后会显示

    这里写图片描述

  • 可选参数

    • –port : 指定 新版 缓存服务器的端口,默认是 8126
    • –path : 指定 新版 缓存服务器的缓存路径,默认是 ./cache5.0
    • –legacypath : 指定 旧版 缓存服务器的缓存路径,默认是 ./cache
    • –size : 指定 新版旧版 缓存大小,默认允许达到 50G, 单位是 byte
    • –nolegacy : 不启动 旧版 缓存服务器,否则默认会启动并使用 8125 端口
  • 默认会启动 新版旧版 缓存服务器,可以通过 –nolegacy 指定不启动 旧版 。新版适用于 5.x版本 unity,旧版适用于4.x版本 unity


连接 Cache Server

  • 打开unity编辑器设置, Unity -> Preferences -> Cache Server

    1. 选择 Cache Server Mode = Remote
    2. IP Address 指定为 Cache Server 服务的 ip地址:端口 (127.0.0.1:10241 ,因为是在本机,所以使用回环地址 127.0.0.1,端口 10241),然后 回车 确定
    3. 点击 Check Connection ,成功后显示:Connection successful.

    这里写图片描述


测试 Cache Server

  • 编辑器中不同平台随便切换,会有 “Downloading from cache server” 提示,运行 Cache Server 服务的终端也会飙出一大坨tips

    这里写图片描述

  • 缓存文件夹也会多出一大坨东西

    这里写图片描述

  • 然后平台切换就很节省时间了

  • done

原创粉丝点击