📜 ⬆️ ⬇️

Studying the project folder structure in Unity - version control systems

Good evening habrchane, I decided to translate a single lesson from the section Architecture - MASTERING UNITY PROJECT FOLDER STRUCTURE - VERSION CONTROL SYSTEMS on the official Unity website. At the very end, the article was slightly modified, the VCS (Version Control System) project setting was changed.

PS For those who only get acquainted with Unity3d and prefer video tutorials I advise you to get acquainted with the official video tutorials for a beginner in Russian .

In this lesson, I want to shed some light on:
- The folder structure of the project in Unity .
- What folders and files are needed for version control systems (VCS) .

')
Let's create a new project in Unity called “testproject”, and import the “Standard Assets (Mobile)” package, create a new Test.cs script, attach it to the camera and check our folder structure.

image

You will see that there are quite a few files and folders, the good news is that only two folders should be under control: Assets and ProjectSettings . Other folders are generated based on these two folders.

Here is a quick overview of all files and folders.

Assembly-CSharp-vs.csproj and Assembly-CSharp.csproj - Visual Studio (with the ending - vs at the end of files) and MonoDevelop project files created for your C # scripts.

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

testproject.sln and TestProject-csharp.sln are project files for integrated development tools (IDE) , the first one includes a project with languages ​​- C #, JavaScript and Boo, while the second file is only for a project with C # language and is intended to open in Visual Studio , because VS "does not know" the JavaScript scripts and the Boo project.

testproject.userprefs and TestProject-csharp.userprefs are configuration files where MonoDevelop saves the current files, recovery points, time, etc.

NOTE : All files listed above, except for all .userprefs files that are re-created each time when Assets -> Sync MonoDevelop Project is selected in the Unity editor menu (Project Sync).

TIP : After synchronizing the project in MonoDevelop , then testproject.sln will open with all the project files, but if you do not have JavaScript code, then in the project you can open TestProject-csharp.sln , which has half the size of the project files and no errors with js .

folder structure of the project in Unity :

image

Assets - folder in which all game resources are stored, including scripts, textures, sounds, etc. This is definitely the most important folder in your project.

ProjectSettings - this folder stores all Unity project settings, such as physics, tags, game settings, etc. In other words, everything that you made in the menu Edit Edit Project Settings goes to this folder.

image

Library is a local cache for Assets being imported, when using an external version control system (VCS) this folder should be excluded from the VCS list.

OBJ and Temp are folders for temporary files created during the project build, OBJ is used by MonoDevelop , Temp is used by Unity .

Here is a quick guide for Unity 4.x installation:

First, suppose we have a Subversion repository at svn: //my.svn.server.com/ and we want to create a project at svn: //my.svn.server.com/MyUnityProject . Then follow these steps to make the initial import into the system:

Create a new project in Unity and name it InitialUnityProject . You can add any source assets here or do it later.


Detailed instructions taken from this page.

Now you are ready to use your favorite version control system (VCS) . Do not forget to add all folders to the ignore list, except for Assets and ProjectSettings folders.

Question number 1


Here I have two folders that I downloaded from someone else's repository. How can I restore the whole project now? Create empty and put folders there or is there a more direct way?

Answer:


1 Option. Create an empty project and move folders there.
Option 2. You had to create a project before uploading from the repository. For this setting, an empty project and presented in the article. And what will you then do with this empty project (synchronize with some repositories, or create your project from scratch and upload to the repository. Your case as they say)

Source: https://habr.com/ru/post/250711/


All Articles