更新
介绍
所有资源进入 Unity 时都要导入转化成 Unity 内部支持的格式才可以使用。
如果在一个团队中工作,那么没有必要让所有人重复地导入资源,完全可以重用第一个人导入时的缓存。
Unity Cache Server 就是利用此缓存的服务器。服务器配置完成后,其他人只需要在 Unity 中设置地址使用即可,完全不会对工作流做出任何改变。
Unity - Manual: Cache Server
环境
- Unity 5.5.1f1
- CentOS 7.3 1611
下载
访问 Unity 下载页面根据自己当前版本下载对应的 Cache Server。
Unity - Download Archive
安装
文件
上传并解压
1
2
3
4
5
|
scp CacheServer-5.5.1f1.zip root@server:/opt
ssh root@server
cd /opt
unzip CacheServer-5.5.1f1.zip
mv CacheServer UnityCacheServer
|
服务
增加专用用户
1
2
3
|
adduser unity -s /sbin/nologin
cd /opt
chown -R unity:unity UnityCacheServer
|
配置服务文件
1
|
vi /etc/systemd/system/unity-cache-server.service
|
在这里需要指定必要的参数,如路径、缓存大小、禁用 5.0 以前版本支持。
服务文件内容:
1
2
3
4
5
6
7
8
9
10
11
12
|
[Unit]
Description=Unity Cache Server Service
After=network.target
[Service]
Type=simple
User=unity
ExecStart=/opt/UnityCacheServer/RunLinux.sh --path /opt/UnityCacheServer/cache5.0 --size 107374182400 --nolegacy
Restart=on-abort
[Install]
WantedBy=multi-user.target
|
运行控制
开机自启动、运行与状态
1
2
3
|
systemctl enable unity-cache-server
systemctl start unity-cache-server
systemctl status unity-cache-server
|
检查运行日志
运行以下命令可以以 tail 方式持续实时地显示日志,使用 Ctrl+C 退出:
1
|
sudo journalctl -u unity-cache-server -f
|
停止服务
1
|
systemctl stop unity-cache-server
|
防火墙
需要将默认端口 8126 放到允许列表中:
1
2
|
firewall-cmd --zone=public --add-port=8126/tcp --permanent
firewall-cmd --reload
|
测试
Unity
> Preferences
> Cache Server
Cache Server Mode
> Remote
IP Address
> 服务器 IP
Check Connection
测试
成功的话会显示 Connection successful.
升级
升级时要注意需要将缓存目录 cache5.0
保留下来。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
scp CacheServer-5.5.1f1.zip root@server:/opt
ssh root@server
systemctl stop unity-cache-server
cd /opt
unzip CacheServer-5.5.1f1.zip
mv UnityCacheServer/cache5.0 CacheServer/
rm -rf UnityCacheServer
mv CacheServer UnityCacheServer
chown -R unity:unity UnityCacheServer
systemctl start unity-cache-server
systemctl status unity-cache-server
|
参考资料