Studying the folder structure of a project in Unity - version control systems

  • Tutorial
Good evening habrchane, I decided to translate one 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 configuration of the VCS (Version Control System) project was changed .

PS for those who are just getting to know Unity3d and prefer video tutorials, I advise you to get acquainted with the official video tutorials for a beginner in Russian .

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


Let's create a new project inUnity called “testproject”, and import the package “Standard Assets (Mobile)”, 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 controlled: Assets and ProjectSettings . Other folders are generated based on these two folders.

Here is a brief overview of all files and folders.

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

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

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

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

NOTE: All files listed above, with the exception of all .userprefs files that are re-created each time you select Assets -> Sync MonoDevelop Project in the Unity editor menu .

TIP : After synchronizing the project in MonoDevelop , then testproject.sln opens 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 as many project files and no errors related with js .

project folder structure in Unity :

image

Assets- A 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 contains all the settings of the Unity project, such as physics, tags, game settings, etc. In other words, everything you made in the menu Edit → Project Settings goes to this folder.

image

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

OBJ and Temp - folders for temporary files created during project build, OBJMonoDevelop is used , 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 so later.
  • Enable Visible Meta files in the menu Edit-> Project Settings-> Editor
  • Close Unity (to make sure all files are exactly preserved).
  • Delete the Library directory inside the directory with your project.
  • Import the folder with your projects into Subversion . If you use the client command line, this is done something like this, from the folder where your initial project is located:
    if successful, the project should now be imported into Subversion, and you can delete the InitialUnityProject directory if you want.
  • Check out the project in Subversion SVN at svn: //my.svn.server.com/MyUnityProject . And check that the Assets and ProjectSettings folders are versioned.
  • Open the project in Unity , starting it holding Option or left Alt. Opening the project will recreate the Library folder that you specified in step 4.
  • Optional: Set the ignore filter for the unversioned Library: svn propedit folder svn: ignore MyUnityProject / Subversion will be opened in a text editor. By adding the Library directory .
  • Finally apply the changes. Now the project should be set up and ready: SVN CI -m “Final project import” MyUnityProject


Detailed instructions are taken from this page.

Now you are ready to use your favorite version control system (VCS) . Remember to add all folders to the ignored 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 entire 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 should have created a project before downloading from the repository. For this, the settings for the empty project are presented in the article. And then what will you do with this empty project (synchronize with some repositories, or create your own project from scratch and upload to the repository. Your business, as they say)

Also popular now: