返回介绍

资源服务器 (Asset Server)(仅限团队许可证)

发布于 2021-06-19 18:03:19 字数 14597 浏览 1059 评论 0 收藏 0

Unity 资源服务器 (Asset Server) 概述

Unity 资源服务器 (Asset Server) 是将图形用户界面集成至 Unity 的资源和版本控制系统。它意味着由团队成员在现场或以远程方式合作,使用不同的计算机共同处理一个工程。资源服务器 (Asset Server) 进行了高度优化,适用于处理大型二进制资源,可处理大型的数千兆字节工程文件夹。 上传资源时,导入设置 (Import Settings) 和每个资源的其他元数据也将上传至资源服务器。重命名和移动文件是本系统的核心功能,将得到良好的支持。

此许可证仅适用于 Unity 专业版,是适合每个客户端的附加许可证。要购买资源服务器客户端许可证 (Asset Server Client License),请访问 Unity 商店 http://unity3d.com/store

不了解源代码管理 (Source Control)?

如果您从未用过源代码管理 (Source Control),刚开始接触任何版本的系统时都会有点困难。源代码管理 (Source Control) 的工作包括在某种类型服务器的数据库中存储所有资源的完整集合 - 网格、纹理、材质、脚本和所有其他资源。该服务器可以是您用于运行 Unity 的家庭计算机,也可以是您本地网络中的其他计算机,还可以是世界其他地方的远程计算机,甚至是虚拟机器,有很多种可能。但服务器的位置根本不重要,重要的是,您能够以某种方式通过您的网络访问服务器,并且服务器会存储您的游戏数据。

从某种程度上来讲,资源服务器 (Asset Server) 是作为工程文件夹 (Project Folder) 的备份来用。开发资源服务器 (Asset Server) 时,不可直接更改其内容。但您可在本地更改您的工程,完成后,提交更改 (Commit Changes) 至服务器 (Server) 上的工程 (Project)。这使得本地工程 (Project) 与资源服务器工程 (Asset Server Project) 相同。

现在,与您合作的开发人员作出更改,令资源服务器 (Asset Server) 与他们的工程而非您的工程相同。要同步您的本地工程,可请求更新服务器 (Update from Server)。现在,无论团队成员做何更改,都将从服务器下载至您的本地工程 (Project)。

这是资源服务器 (Asset Server) 的基本工作流程。 除此基本功能之外,资源服务器 (Asset Server) 还可回滚至先前版本的资源、对文件进行细致对比、合并两个不同的脚本、解决冲突和恢复删除的资源。

设置资源服务器 (Asset Server)

资源服务器 (Asset Server) 需要进行一次性的服务器设置,并为每个用户配置客户端。您可以参阅资源服务器设置 (Asset Server Setup) 页面了解上述操作。

本指南的余下内容将介绍如何部署、管理和定期使用资源服务器 (Asset Server)。

Daily use of the Asset Server

This section explains the common tasks, workflow and best practices for using the Asset Server on a day-to-day basis.

Getting Started

If you are joining a team that has a lot of work stored on the Asset Server already, this is the quickest way to get up and running correctly. If you are starting your own project from scratch, you can skip down to the Workflow Fundamentals section.

  1. Create a new empty Project with no packages imported
  2. Go to Edit->Project Settings->Editor and select Asset Server as the version control mode
  3. From the menubar, select Window->Version
  4. Click the Connection button
  5. Enter your user name and password (provided by your Asset Server administrator)
  6. Click Show Projects and select the desired project
  7. Click Connect
  8. Click the Update tab
  9. Click the Update button
  10. If a conflict occurs, discard all local versions
  11. Wait for the update to complete
  12. You are ready to go

Continue reading for detailed information on how to use the Asset Server effectively every day.

Workflow Fundamentals

When using the Asset Server with a multi-person team, it is generally good practice to Update all changed assets from the server when you begin working, and Commit your changes at the end of the day, or whenever you're done working. You should also commit changes when you have made significant progress on something, even if it is in the middle of the day. Committing your changes regularly and frequently is recommended.

Understanding the Server View

The Server View is your window into the Asset Server you're connected to. You can open the Server View by selecting Window->Version Control.


The Overview tab

The Server View is broken into tabs: Overview Update, and Commit. Overview will show you any differences between your local project and the latest version on the server with options to quickly commit local changes or download the latest updates. Update will show you the latest remote changes on the server and allow you to download them to your local project. Commit allows you to create a Changeset and commit it to the server for others to download.

Connecting to the server

Before you can use the asset server, you must connect to it. To do this you click the Connection button, which takes you to the connection screen:


The Asset Server connection screen

Here you need to fill in:

  1. Server address
  2. Username
  3. Password

By clicking Show projects you can now see the available projects on the asset server, and choose which one to connect to by clicking Connect. Note that the username and password you use can be obtain from your system administrator. Your system administrator created accounts when they installed Asset Server.

Updating from the Server

To download all updates from the server, select the Update tab from the Overview tab and you will see a list of the latest committed Changesets. By selecting one of these you can see what was changed in the project as well as the provided commit message. Click Update and you will begin downloading all Changeset updates.


The Update Tab

Committing Changes to the Server

When you have made a change to your local project and you want to store those changes on the server, you use the top Commit tab.


The Commit tab

Now you will be able to see all the local changes made to the project since your last update, and will be able to select which changes you wish to upload to the server. You can add changes to the changeset either by manually dragging them into the changeset field, or by using the buttons placed below the commit message field. Remember to type in a commit message which will help you when you compare versions or revert to an earlier version later on, both of which are discussed below.

Resolving conflicts

With multiple people working on the same collection of data, conflicts will inevitably arise. Remember, there is no need to panic! If a conflict exists, you will be presented with the Conflict Resolution dialog when updating your project.


The Conflict Resolution screen

Here, you will be informed of each individual conflict, and be presented with different options to resolve each individual conflict. For any single conflict, you can select Skip Asset (which will not download that asset from the server), Discard My Changes (which will completely overwrite your local version of the asset) or Ignore Server Changes (which will ignore the changes others made to the asset and after this update you will be able to commit your local changes over server ones) for each individual conflict. Additionally, you can select Merge for text assets like scripts to merge the server version with the local version.

Note: If you choose to discard your changes, the asset will be updated to the latest version from the server (i.e., it will incorporate other users' changes that have been made while you were working). If you want to get the asset back as it was when you started working, you should revert to the specific version that you checked out. (See Browsing revision history and reverting assets below.)

If you run into a conflict while you are committing your local changes, Unity will refuse to commit your changes and inform you that a conflict exists. To resolve the conflicts, select Update. Your local changes will not automatically be overwritten. At this point you will see the Conflict Resolution dialog, and can follow the instructions in the above paragraph.

Browsing revision history and reverting assets

The Asset Server retains all uploaded versions of an asset in its database, so you can revert your local version to an earlier version at any time. You can either select to restore the entire project or single files. To revert to an older version of an asset or a project, select the Overview tab then click Show History listed under Asset Server Actions. You will now see a list of all commits and be able to select and restore any file or all project to an older version.


The History dialog

Here, you can see the version number and added comments with each version of the asset or project. This is one reason why descriptive comments are helpful. Select any asset to see its history or Entire Project for all changes made in project. Find revision you need. You can either select whole revision or particular asset in revision. Then click Download Selected File to get your local asset replaced with a copy of the selected revision. Revert All Project will revert entire project to selected revision.

Prior to reverting, if there are any differences between your local version and the selected server version, those changes will be lost when the local version is reverted.

If you only want to abandon the changes made to the local copy, you don't have to revert. You can discard those local modifications by selecting Discard Changes in the main asset server window. This will immediately download the current version of the project from the server to your local Project.

Comparing asset versions

If you're curious to see the differences between two particular versions you can explicitly compare them. To do this, open History window, select revision and asset you want to compare and press Compare to Local Version. If you need to compare two different revisions of an asset - right click on it, in the context menu select Compare to Another Revision then find revision you want to compare to and select it.

Note: this feature requires that you have one of supported file diff/merge tools installed. Supported tools are:

Recovering deleted assets

Deleting a local asset and committing the delete to the server will in fact not delete an asset permanently. Just as any previous version of an asset can be restored through History window from the Overview tab.


The History dialog

Expand Deleted Assets item, find and select assets from the list and hit Recover, the selected assets will be downloaded and re-added to the local project. If the folder that the asset was located in before the deletion still exists, the asset will be restored to the original location, otherwise it will be added to the root of the Assets folder in the local project.

Best Practices & Common Issues

This is a compilation of best practices and solutions to problems which will help you when using the Asset Server:

  1. Backup, Backup, Backup
    • Maintain a backup of your database. It is very important to do this. In the unfortunate case that you have a hardware problem, a virus, a user error, etc you may loose all of your work. Therefore make sure you have a backup system in place. You can find lots of resources online for setting up backup systems.
  2. Stop the server before shutting the machine down
    • This can prevent "fast shutdowns" from being generated in the PostgreSQL (Asset Server) log. If this occurs the Asset Server has to do a recovery due to an improper shut down. This can take a very long time if you have a large project with many commits.
  3. Resetting you password from Console
    • You can reset your password directly from a shell, console or command line using the following command:

      psql -U unitysrv -d template1 -c"alter role admin with password 'MYPASSWORD'"
  4. Can't connect to Asset Server
    • The password may have expired. Try resetting your password.
    • Also the username is case sensitive: "Admin" != "admin". Make sure you are using the correct case.
    • Make sure the server is actually running:
      • On OS X or Linux you can type on the terminal: ps -aux
      • On Windows you can use the Task Manager.
    • Verify that the Asset Server is not running on more than one computer in your Network. You could be connecting to the wrong one.
  5. The Asset Server doesn't work in 64-bit Linux
    • The asset server can run OK on 64-bit Linux machines if you install 32-bit versions of the required packages. You can use "dpkg -i --force-architecture" to do this.
  6. Use the Asset Server logs to get more information
    • Windows:
      • \Unity\AssetServer\log
    • OS X:
      • /Library/UnityAssetServer/log

Asset Server training complete

You should now be equipped with the knowledge you need to start using the Asset Server effectively. Get to it, and don't forget the good workflow fundamentals. Commit changes often, and don't be afraid of losing anything.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文