在Unity 3D中使用Git源代码控制的最佳实践是什么,特别是在处理Unity 3D项目的二进制性质时?请描述工作流程,在.gitignore中包含哪些路径,应该在Unity和/或项目中设置什么设置,以及任何其他应该注意的特殊事情。
注意:我知道使用资产服务器是unity推荐的方式,但出于各种原因,我想使用Git。请不要回答,状态或争论,我应该只是使用资产服务器。资产服务器真的不是我的选择。
在Unity 3D中使用Git源代码控制的最佳实践是什么,特别是在处理Unity 3D项目的二进制性质时?请描述工作流程,在.gitignore中包含哪些路径,应该在Unity和/或项目中设置什么设置,以及任何其他应该注意的特殊事情。
注意:我知道使用资产服务器是unity推荐的方式,但出于各种原因,我想使用Git。请不要回答,状态或争论,我应该只是使用资产服务器。资产服务器真的不是我的选择。
当前回答
我想我可以发布一个更简单的。gitignore给感兴趣的人:
# Ignore Everything
/*
# Except for these
!/.gitignore
!/Assets
!/Packages
!/ProjectSettings
其他回答
Unity还提供了自己的源代码版本控制。在unity5之前,它是unityAsset Server,但现在它贬值了。并推出新的SVN控制系统unity collaboration。但是使用unity和任何SVN的主要问题是提交和合并场景。但svn的Non为我们提供了解决这种冲突或合并场景的方法。所以取决于你熟悉哪个SVN。我在Mac上使用SmartSVN工具。在Windows上乌龟。
我们现在有无缝集成到unity与Github到unity扩展… https://unity.github.com/
新的GitHub for Unity扩展带来了GitHub工作流和更多的Unity,提供支持大文件与Git LFS和文件锁定。
在撰写本文时,该项目仍处于alpha阶段,但仍可用于个人项目。
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!
除此之外,在Unity中使用git lfs也是很理想的。自从它问世以来,我一直在使用它,我没有遇到任何麻烦。
您需要将这个.gitattributes添加到.gitignore文件旁边
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
*.physicsMaterial2D merge=unityyamlmerge eol=lf
*.physicsMaterial merge=unityyamlmerge eol=lf
*.asset merge=unityyamlmerge eol=lf
*.meta merge=unityyamlmerge eol=lf
*.controller merge=unityyamlmerge eol=lf
*.a filter=lfs diff=lfs merge=lfs -text
*.mp3 filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text
*.aif filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.exr filter=lfs diff=lfs merge=lfs -text
*.fbx filter=lfs diff=lfs merge=lfs -text
*.FBX filter=lfs diff=lfs merge=lfs -text
*.rns filter=lfs diff=lfs merge=lfs -text
*.reason filter=lfs diff=lfs merge=lfs -text
*.lxo filter=lfs diff=lfs merge=lfs -text
这是我的滚动文件列表。如果使用未列出的其他二进制文件,请添加它们。
我也有文件配置使用yamlmerge,你需要设置这个。你可以在这里阅读:http://docs.unity3d.com/Manual/SmartMerge.html
编辑->项目设置->编辑器
“版本控制”设置为“元文件”。将资产序列化设置为强制文本。
我觉得这就是你想要的。