在Unity 3D中使用Git源代码控制的最佳实践是什么,特别是在处理Unity 3D项目的二进制性质时?请描述工作流程,在.gitignore中包含哪些路径,应该在Unity和/或项目中设置什么设置,以及任何其他应该注意的特殊事情。

注意:我知道使用资产服务器是unity推荐的方式,但出于各种原因,我想使用Git。请不要回答,状态或争论,我应该只是使用资产服务器。资产服务器真的不是我的选择。


当前回答

I suggest that you make a .gitignore file that includes everything other than the assets folder (all the other files that are originally inside a unity project). Next, you should place all your game projects in one folder. Next, duplicate the .gitignore in every single project folder for your games. This will exclude the libraries and unnecessary folders inside your projects other than the assets. If you have any projects you don't want, then put them in a new .gitignore inside where your game projects are stored. Note: You can have multiple .gitignore's and .gitignore is based on relative paths. I hope that helped!

其他回答

你可以使用Github for Unity,这是一个Unity扩展,将git工作流带入Unity的UI中。

Github for Unity刚刚发布了扩展的1.0版本。

它使用git-lfs (git大文件支持)来正确存储大资产 文件锁定,这样其他人就不会覆盖您的资产提交 向/从任何远程存储库推送和拉取 你也可以在Unity资产商店下载:https://assetstore.unity.com/packages/tools/version-control/github-for-unity-118069

I suggest that you make a .gitignore file that includes everything other than the assets folder (all the other files that are originally inside a unity project). Next, you should place all your game projects in one folder. Next, duplicate the .gitignore in every single project folder for your games. This will exclude the libraries and unnecessary folders inside your projects other than the assets. If you have any projects you don't want, then put them in a new .gitignore inside where your game projects are stored. Note: You can have multiple .gitignore's and .gitignore is based on relative paths. I hope that helped!

我强烈建议你切换到PlasticSCM。 这是Unity所迁移的内容,并提供了设计师和开发者工作流来管理游戏开发等复杂内容的版本控制。

3个用户可以免费获得云版。它取代了Unity的协作工具。

注意:我使用Git/Bitbucket和SourceTree来管理一个简单的项目真的很困难。

https://unity.com/products/plastic-scm

编辑->项目设置->编辑器

“版本控制”设置为“元文件”。将资产序列化设置为强制文本。

我觉得这就是你想要的。

什么是GIT?

Git是一个免费的开源分布式版本控制系统(SCM),由Linus Torvalds于2005年(Linux操作系统的创始人)开发。它的创建是为了控制从小到大的项目的速度和效率。谷歌、Facebook、微软等领先公司每天都在使用GIT。

如果你想了解更多关于GIT的知识,请查看这个快速教程,

首先,确保已经设置好Git环境。您需要设置本地环境和Git存储库(我更喜欢Github.com)。

GIT客户端应用程序Mac/Windows

对于GIT gui客户端应用程序,我建议你去Github.com,

GitHub是一个可以与朋友、同事、同学和完全陌生的人分享代码的地方。超过500万人使用GitHub一起创建令人惊叹的东西。

Unity3d设置

你需要做这些设置

切换到“编辑→项目设置→编辑器→版本控制模式”中的“可见元文件”。

在Unity中启用外部选项→Preferences→Packages→Repository

在“编辑→项目设置→编辑器→资产序列化模式”中切换到“强制文本”。

来源: 使用Git与3D游戏源代码控制