在Unity 3D中使用Git源代码控制的最佳实践是什么,特别是在处理Unity 3D项目的二进制性质时?请描述工作流程,在.gitignore中包含哪些路径,应该在Unity和/或项目中设置什么设置,以及任何其他应该注意的特殊事情。
注意:我知道使用资产服务器是unity推荐的方式,但出于各种原因,我想使用Git。请不要回答,状态或争论,我应该只是使用资产服务器。资产服务器真的不是我的选择。
在Unity 3D中使用Git源代码控制的最佳实践是什么,特别是在处理Unity 3D项目的二进制性质时?请描述工作流程,在.gitignore中包含哪些路径,应该在Unity和/或项目中设置什么设置,以及任何其他应该注意的特殊事情。
注意:我知道使用资产服务器是unity推荐的方式,但出于各种原因,我想使用Git。请不要回答,状态或争论,我应该只是使用资产服务器。资产服务器真的不是我的选择。
当前回答
我和我的朋友在72小时的游戏jam中尝试过这种方法,请注意他们不知道GIT。
首先,我在[GitHub][1](私人回购现在是免费的)与预定义的.gitignore统一模板创建空回购,它应该与此相同:
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
[Ll]ogs/
[Mm]emoryCaptures/
# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta
# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*
# Autogenerated Jetbrains Rider plugin
[Aa]ssets/Plugins/Editor/JetBrains*
# Visual Studio cache directory
.vs/
# Gradle cache directory
.gradle/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db
# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta
# Unity3D generated file on crash reports
sysinfo.txt
# Builds
*.apk
*.unitypackage
# Crashlytics generated file
crashlytics-build.properties
Then I've created a main scene, this scene shouldn't be modified by any individual while they are development, It should be the demo scene for all dev and artists in the team to test the latest features in game. First of all any new feature should be in a separate branch from main, also each team member has his own scene that he use it for testing and development. once everything is good he/she made a PR reviewed by other members. If the merged feature is complete then we add it to the main scene so that all other members see the impact and the progress.
关于美术文件,最好是通过精灵文件的变化来避免冲突,并将主要精灵替换为pr中完全调整过的新精灵。 [1]: https://github.com/
其他回答
Unity还提供了自己的源代码版本控制。在unity5之前,它是unityAsset Server,但现在它贬值了。并推出新的SVN控制系统unity collaboration。但是使用unity和任何SVN的主要问题是提交和合并场景。但svn的Non为我们提供了解决这种冲突或合并场景的方法。所以取决于你熟悉哪个SVN。我在Mac上使用SmartSVN工具。在Windows上乌龟。
我强烈建议你切换到PlasticSCM。 这是Unity所迁移的内容,并提供了设计师和开发者工作流来管理游戏开发等复杂内容的版本控制。
3个用户可以免费获得云版。它取代了Unity的协作工具。
注意:我使用Git/Bitbucket和SourceTree来管理一个简单的项目真的很困难。
https://unity.com/products/plastic-scm
编辑->项目设置->编辑器
“版本控制”设置为“元文件”。将资产序列化设置为强制文本。
我觉得这就是你想要的。
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!
只有Assets和ProjectSettings文件夹需要置于git版本控制之下。
你可以做一个这样的gitignore。
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
# Autogenerated VS/MD solution and project files
*.csproj
*.unityproj
*.sln
*.suo
*.userprefs
# Mac
.DS_Store
*.swp
*.swo
Thumbs.db
Thumbs.db.meta
.vs/