警告:这是旧版文档 |
---|
注意,从 2017.1 版开始,Asset Server 产品已弃用。我们建议在您的Unity项目中使用 Plastic SCM 或 Perforce 进行版本控制。2017–06–30 |
Asset Server 只需在服务器计算机上进行简单的一次性安装。与 Asset Server 的交互是通过 Unity 完成的。Unity 可以安装在服务器计算机上,但不需要这样做。必须从客户端计算机管理它,在其中可以添加项目和用户。必须使用特定的用户凭据来配置每个额外的客户端以便与项目同步。
您可以在 Mac OS X 10.4 或更高版本、Windows Vista 和各种 Linux 发行版(包括 CentOS、Ubuntu 和 Suse Linux)上安装 Asset Server。 请从此处下载 Unity Asset Server。
安装程序将安装所有必要的文件、设置数据库并启动 Asset Server。在安装过程结束时,系统将要求创建__管理员密码__。从 Unity 中管理 Asset Server 时需要此密码。必须先以管理员身份连接到 Asset Server,然后才能创建项目或用户。
Asset Server 允许任意数量的__用户__连接到__项目__。管理员必须首先使用 Unity 作为客户端连接到服务器并创建新的项目和用户。
本指南将介绍如何启动和运行服务器并使其随时可用。
请注意,__Asset Server__ 现在是旧版产品。我们建议使用 Plastic SCM 或 Perforce 在 Unity 项目中进行版本控制。
1. 启动 Unity 并打开一个空项目。选择 Window > Asset Management > Version Control__,然后单击 Settings__ 按钮。
随后将在 Inspector 中显示 Version Control 设置,现在请从 Mode 下拉菜单中选择 Asset Server。
2. 现在我们要运行 Asset Server。找到并运行以下文件:
Windows:C:\Program Files (x86)\Unity\AssetServer\bin\AssetServerControl.exe
Macintosh:/Library/UnityAssetServer
注意:Yosemite 10.10.3 用户需要通过硬盘驱动器的库目录(而不是用户的库目录)进行搜索。
3. 现在可选择 Window > Asset Management > Version Control。随后将打开 Asset Server 的管理选项卡。
单击 Administration 按钮。
4. 在 Server Address 字段中,输入您要管理的 Asset Server 所在的计算机的 IP 地址__或__主机名。如果 Asset Server 安装在本地计算机上,则可在 Server Address 字段中输入“localhost”。接下来,提供管理员名称和密码。管理员名称始终为“admin”,密码是安装 Asset Server 时输入的密码。最后,单击 Connect 按钮。您现在已连接到 Asset Server,并可以执行初始设置。
每个服务器可以包含多个项目,每个用户可以拥有一个或多个项目的权限。项目通常互不相关,并且在资源集合中是唯一的。最好是“将一个项目视为一个游戏”。
可通过单击 Server Administration 选项卡中的 Create 按钮创建新项目。
首先选择现有项目,然后单击 New User 按钮,即可创建新用户。
在一个项目中创建用户后,可通过启用用户列表中用户名左侧的复选框将用户添加到另一个项目。
您可以为单个项目启用或禁用用户访问权限。 要从服务器中完全删除项目或用户,请使用 Delete Project 和 Delete User 按钮。
Unity Asset Server 使用 TCP 端口 10733。您可能需要在防火墙和/或路由器中启用与此端口的连接。
Asset Server 是使用 PostgreSQL 的修改版本构建的。直接访问 SQL 数据库需要一些关于 SQL 和 Unix/Linux 命令行的技术知识。建议用户谨慎操作。
我们提供了一个命令行工具来备份 Asset Server。应在运行 Asset Server 的计算机上使用管理员帐户运行该工具。将 BACKUP_LOCATION 替换为您希望备份工具放置备份的路径名:
Mac OS X
sudo /Library/UnityAssetServer/bin/as_backup
BACKUP_LOCATION
Linux
sudo /opt/unity_asset_server/bin/as_backup
BACKUP_LOCATION
Windows
"%ProgramFiles%\Unity\AssetServer\bin\as_backup.cmd"
BACKUP_LOCATION
as_backup 将在 BACKUP_LOCATION 位置创建一个目录,其中包含每个项目的一个或多个文件,还有一些文件包含每个项目的相关信息以及所有用户及其密码的备份。
要恢复通过 as_backup 生成的 Asset Server 备份,请首先执行 Asset Server 的全新安装,不要创建任何项目。(恢复过程将拒绝覆盖同名的现有项目。)
然后运行提供的备份恢复工具 as_restore
,将其指向使用 as_backup 创建的备份的位置:
Mac OS X
sudo /Library/UnityAssetServer/bin/as_restore
BACKUP_LOCATION
Linux
sudo /opt/unity_asset_server/bin/as_restore
BACKUP_LOCATION
Windows
"%ProgramFiles%\Unity\AssetServer\bin\as_restore.cmd"
BACKUP_LOCATION
请注意,您还可以使用 as_backup 和 as_restore 将 Asset Server 安装结果从一台计算机移动到另一台计算机,方法是在源计算机上执行备份,将备份目录移动到目标计算机(或通过网络文件共享方式安装该目录),然后运行 as_restore 将数据插入新安装的 Asset Server 实例。即使源和目标 Asset Server 具有不同版本或在不同操作系统上运行,这种做法也是有效的。
要查看项目数据库中的表,首先需要确定实际数据库的名称。在托管 Asset Server 的计算机上运行以下命令行命令:
Mac OS X
/Library/UnityAssetServer/bin/psql -U admin -h localhost -d postgres -c 'select * from all_databases**view'
Linux
/opt/unity_asset_server/bin/psql -U admin -h localhost -d postgres -c 'select * from all_databases**view'
Windows
"%ProgramFiles%\Unity\AssetServer\bin\psql.exe" -U admin -h localhost -d postgres -c "select * from all_databases**view"
此命令及其他命令将提示您输入密码。每次发生这种情况时,请输入在安装期间设置的数据库管理员密码。得到的结果将是遵循以下基本布局的表:
databasename | projectname | description | version
--------------------+--------------------+--------------------------+---------
sandbox | Sandbox | Created with Unity 2.0.0 | 1.0
game | Game | Created with Unity 2.0.0 | 1.0
my_game_project | My Game Project | Created with Unity 2.0.0 | 1.0
(3 rows)
现在您需要确定要备份的项目的“databasename”。创建数据库时,默认的“databasename”与 Unity 中显示的“projectname”相同,但采用小写字母并将空格替换为下划线。
请注意,如果您的服务器在不同端口上托管多个 PostgreSQL 数据库,可能需要显式提供用于连接到 Asset Server 数据库的端口。在这种情况下,请将 -p 10733 添加到给定的命令(假设您的实例使用了默认端口 10733)。例如:
Linux
/opt/unity_asset_server/bin/psql -U admin -h localhost -d postgres -c 'select * from all_databases**view' -p 10733
这些命令及所有其他命令将使用 PostgreSQL 发行版中的工具。您可以在此处阅读更多关于这些工具的信息:http://www.postgresql.org/docs/8.3/interactive/reference-client.html
2017–06–30 页面已修订
在 2017.1 中已弃用 Asset Server
在 2018.1 版中删除了独立平台播放器中的 Windows XP 支持
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.