Mastering Unity Project Folder Structure - Version Control Systems
Revisado con versión: 4.3
In this tutorial I’ll shine some light on Unity Project folder structure. Which folders and files are required for version control systems?
Lets create new Unity project called “testproject”, import “Standard Assets (Mobile)” package, create new Test.cs script attached to camera and check our folder structure.
You’ll find that there are quite a lot of files and folders, good news that only two folders should be kept under source control: Assets and ProjectSettings. Others are generated from these two.
Here is a quick overview of all files and folders.
Assembly-CSharp-vs.csproj and Assembly-CSharp.csproj – Visual Studio (with -vs suffix) and MonoDevelop project files generated for your C# scripts.
testproject.userprefs and testproject-csharp.userprefs – configuration files where MonoDevelop stores current opened files, breakpoints, watches etc.
NOTE All files listed above except .userprefs are re-generated each time you select Assets -> Sync MonoDevelop Project in Unity Editor menu.
Assets – folder where all game resources are stored, including scripts, textures, sound, custom editors etc. Definitely the most important folder in your project.
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.
Library – local cache for imported assets, when using external version control system should be completely ignored.
obj and Temp – folders for temporary files generated during build, first one used by MonoDevelop, second – by Unity.
Here is a short setup guide for Unity 4.3:
Enable External option in Unity → Preferences → Packages → Repository
Switch to Hidden Meta Files in Editor → Project Settings → Editor → Version Control Mode
Switch to Force Text in Editor → Project Settings → Editor → Asset Serialization Mode
Save scene and project from File menu
Now you are ready to use your favorite version control system. Don’t forget to add everything except Assets and ProjectSettings folders to your ignore list. Here is .gitignore we use in our project:
=============== 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