(搬运自我在SegmentFault的博客)

本文参考了Unity官网的Mastering Unity Project Folder Structure - Version Control SystemsUsing External Version Control Systems with Unity

首先需要了解一下Unity的目录结构。假设有一个叫做testproject的项目,那么它的结构应该如下图所示。

Assembly-CSharp-vs.csproj and Assembly-CSharp.csproj – Visual Studio (with -vs suffix) and MonoDevelop project files generated for your C# scripts.

Assembly-CSharp-vs.csproj 和 Assembly-CSharp.csproj :Visual Studio(带有-vs后缀)和MonoDevelop为C#脚本生成的项目文件。

Assembly-UnityScript-vs.unityproj and Assembly-UnityScript.unityproj – the same project files but for JavaScript scripts.

Assembly-UnityScript-vs.unityproj 和 Assembly-UnityScript.unityproj:相同的项目文件,只不过是为JavaScript脚本。

testproject.sln and testproject-csharp.sln – solution files for IDEs, first one includes all C#, JavaScript and Boo projects, while the second one – only C# projects and is designed to be opened in Visual Studio, because VS doesn’t know to handle JavaScript and Boo projects.

testproject.sln 和 testproject-csharp.sln:IDE的解决方案文件,第一个包括所有的C#、JavaScript和Boo脚本;而第二个只包括C#脚本,被设计用来在Visual Studio中打开,因为VS不知道如何处理JavaScript和Boo项目。

testproject.userprefs and testproject-csharp.userprefs – configuration files where MonoDevelop stores current opened files, breakpoints, watches etc.

testproject.userprefs 和 testproject-csharp.userprefs:MonoDevelop用来存储当前打开文件、断点、观测等的配置文件。

Assets – folder where all game resources are stored, including scripts, textures, sound, custom editors etc. Definitely the most important folder in your project.

Assets:存储所有游戏资源的文件夹,包括脚本、纹理、声音、编辑器定制等。当然是项目中最重要的文件夹。

ProjectSettings – in this folder Unity stores all project settings like Physics, Tags, Player settings etc. In other words everything you setup from Edit → Project Settings set of menus goes into this folder.

ProjectSettings:在这个文件夹中Unity存储所有的项目设置,如物理、标签、角色设置等。或者说,所有你从 Edit → Project 的菜单中设置的都在这个文件夹中。

Library – local cache for imported assets, when using external version control system should be completely ignored.

Library:被导入资源的本地缓存,当使用外部版本控制系统时应当被完全忽略。

obj and Temp – folders for temporary files generated during build, first one used by MonoDevelop, second – by Unity.

obj 和 Temp:存储构建时产生的临时文件的文件夹,第一个用于MonoDevelop,第二个用于Unity。

看完了以上的内容就可以知道,我们只需要将AssetsProjectSettings两个文件夹纳入版本控制即可。但在编写.gitignore文件前,还需要以下几个步骤,将设置以文本形式存储以利于版本控制:

  1. 在 Edit->Project Settings->Editor->Version Control Mode 中选择 Visible Meta files
  2. 在 Edit->Project Settings->Editor->Asset Serialization Mode 中选择 Force Text
  3. 保存场景和项目。

下面是一份参考的.gitignore文件:

===============
Unity generated
===============
Temp/
Library/ =====================================
Visual Studio / MonoDevelop generated
=====================================
ExportedObj/
obj/
*.svd
*.userprefs
/*.csproj
*.pidb
*.suo
/*.sln
*.user
*.unityproj
*.booproj ============
OS generated
============
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

最新文章

  1. linux-----------shell的基础命令
  2. yii2输出sql语句
  3. Post model至Web Api创建或是保存数据
  4. 【转】$_POST 与 php://input的区别分析
  5. js中的换算小技巧
  6. C#各类型大小
  7. DLL技术应用04 - 零基础入门学习Delphi47
  8. Hive操作之HQL语句
  9. MDK的优化应用(转)
  10. HALCON不支持的设备中,获取图像
  11. MyBatis学习资料
  12. ACM学习<3>
  13. 在Ubuntu上安装Chrome Driver和Firefox Driver
  14. CrazySNS has on line - And you'll see why 1984 won't be like "1984."
  15. Codeforces Round #373 (Div. 2) C. Efim and Strange Grade 水题
  16. QQ群免IDKEY加群PHP源码
  17. 关于open_cursors和session_cached_cursors的参数值(转)
  18. 【算法笔记】B1025 反转链表
  19. (转)Mysql数据库管理 表的维护
  20. bzoj 2434 fail tree+dfs序

热门文章

  1. 海外支付:遍布全球的Paypal
  2. telnet登录路由器启动服务的shell脚本
  3. Photoshop Cs5 64位系统破解版下载(内含破解方法)
  4. Loggly:提高ElasticSearch性能的九个高级配置技巧
  5. 关于ORA-04021解决办法(timeout occurred while waiting to lock object)
  6. .NET程序与CA对接一直提示重定向
  7. Swift一些语法
  8. iOS开发中view controller设置问题
  9. hdu2444
  10. MFC创建对话框组件对应变量并进行设置值(VS2010)