Unity 提供了 Asset Server 附加产品,从而轻松实现项目的集成化版本控制。此外,还可以使用 Perforce 和 PlasticSCM 外部工具(请参阅版本控制集成以了解更多详细信息)。如果由于某种原因无法使用这些系统,可以将项目存储在其他任何版本控制系统(例如 Subversion 或 Bazaar)中。这需要对项目进行一些初始手动设置。
在签入项目之前,必须要求 Unity 稍微修改项目结构,使其符合在外部版本控制系统中存储资源的要求。要进行此操作,请在应用程序菜单中选择 Edit > Project Settings > Editor__,然后在 Version Control 的下拉选单中选择 Visible Meta Files__ 来启用外部版本控制支持。这将显示 Assets
目录中每个资源的文本文件,其中包含 Unity 所需的必要记录信息。这些文件将具有 .meta
文件扩展名,第一部分是与其关联的资源的完整文件名。在 Unity 中移动和重命名资源应该也会更新相关的 .meta
文件。但是,如果从外部工具移动或重命名资源,请确保也同步相关的 .meta
文件。
将项目签入版本控制系统时,应该将 Assets
、Packages
和 ProjectSettings
目录添加到系统。应该完全忽略 Library
和 UserSettings
目录,使用 .meta 文件时,它们只是已导入资源的本地缓存位置。
创建新资源时,请确保将资源本身和关联的 .meta
文件都添加到版本控制中。
首先,假设我们在 svn://my.svn.server.com/
上有 Subversion 存储库且希望在 svn://my.svn.server.com/MyUnityProject
上创建项目。
然后按照以下步骤在系统中创建初始导入:
InitialUnityProject
。可以在其中添加任何初始资源,也可以稍后添加资源。Library
和 UserSettings
目录。svn import -m"Initial project import" InitialUnityProject svn://my.svn.server.com/MyUnityProject
如果成功,项目现在应该已经导入 Subversion,而且如果愿意,现在可以删除 InitialUnityProject
目录。svn co svn://my.svn.server.com/MyUnityProject
,然后检查 Assets
、Packages
和 ProjectSettings
目录是否已加入版本控制。Library
和 UserSettings
目录。Library
和 UserSettings
目录设置忽略过滤器:
svn propedit svn:ignore MyUnityProject/
Subversion 将打开文本编辑器。添加 Library 和 UserSettings 目录。svn ci -m"Finishing project import" MyUnityProject
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.