在Unity项目中使用Git
2015-11-06 10:40
435 查看
本文参考了Unity官网的Mastering Unity Project Folder Structure – Version Control Systems和Using External Version Control Systems with Unity。
首先需要了解一下Unity的目录结构。假设有一个叫做
![](http://img.07net01.com/upload/images/2014/09/12/1382931120913411.png)
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。
看完了以上的内容就可以知道,我们只需要将
在 Edit->Project Settings->Editor->Version Control Mode 中选择
在 Edit->Project Settings->Editor->Asset Serialization Mode 中选择
保存场景和项目。
下面是一份参考的
统使用Git的来进行版本控制,有很多免费的开放的服务器,我们可以在里面存储东西,给大家进行分享,也可以在里面搜索很多有用的资源,有很多牛X的程序都在GitHub上(不要说我是做广告的,它们真的没有给我钱)。
要想学习GitHub,请参考:GitHub详细教程Git-it
首先需要了解一下Unity的目录结构。假设有一个叫做
testproject的项目,那么它的结构应该如下图所示。
![](http://img.07net01.com/upload/images/2014/09/12/1382931120913411.png)
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。
看完了以上的内容就可以知道,我们只需要将
Assets和
ProjectSettings两个文件夹纳入版本控制即可。但在编写
.gitignore文件前,还需要以下几个步骤,将设置以文本形式存储以利于版本控制:
在 Edit->Project Settings->Editor->Version Control Mode 中选择
Visible Meta files。
在 Edit->Project Settings->Editor->Asset Serialization Mode 中选择
Force Text。
保存场景和项目。
下面是一份参考的
.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
统使用Git的来进行版本控制,有很多免费的开放的服务器,我们可以在里面存储东西,给大家进行分享,也可以在里面搜索很多有用的资源,有很多牛X的程序都在GitHub上(不要说我是做广告的,它们真的没有给我钱)。
要想学习GitHub,请参考:GitHub详细教程Git-it
相关文章推荐
- RPC failed; result=22, HTTP code = 411
- git更新已經刪除的文件
- About SVN
- 提取Git每次提交后Commit的文件
- GIT迁移服务器
- CentOS 6.5搭建Apache整合SVN 1.8.5服务器(多版本库权限配置)
- CentOS下SVN服务器测试版安装记录
- c#调用COM组件
- 分布式版本管理git入门指南使用资料汇总及文章推荐
- 如何在本机搭建SVN服务器
- Windows下搭建本地SVN服务器
- C#实现把指定数据写入串口
- C#动态创建button的方法
- C#中抽象方法与虚拟方法的区别
- c#中虚函数的相关使用方法
- C#使用加边法计算行列式的值
- C#实现多线程的同步方法实例分析
- C#中尾递归的使用、优化及编译器优化
- C#实现子窗体与父窗体通信方法实例总结
- C#通用邮件发送类分享