Skip to main content

Project Organization

Whether you are working on a solo project or with a team having a solid project structure is not only considered best practice it can save so much time and confusion. One key to good project structure is consistency. When developing a project structure be consistent in the naming convention and usage.

FOLDER STRUCTURE#

The default Unity project file includes the following folder structure, which you can view in the Project window inside the editor.

Default Fold Structure

SPECIAL FOLDERS#

While one can choose to name and set up their Unity project folders in several ways, there are a few special folders reserved for special purposes. Two of these special folders which are included by default are the Assets folder and the Packages folder.

  • Packages folder is located in the project’s root folder and contains a mainfest.json file which maintains dependencies between packages. Essentially the mainfest.json file tells the Unity editor which packages to load into the project by default. In the Unity editor, the individual folders for the packages will be displayed instead of the JSON file.

  • Assets folder is the main folder for all assets in the project. By default, the Asset folder includes a Scene folder for organizing your scenes. It is in the Assets folder which we will create all other folders and establish our project folder structure. Within the Assets folder, there are a few other special folders that may or may not be required for every project, but it is important to be familiar with these folders, as their names are reserved in Unity.

  • Assets/Editor folder contains editor scripts that run in the editor and not at runtime. The Editor folder must be inside the Assets folder or any sub-folder located within the Assets folder. Multiple Editor folders can exist within a project, however, because the Editor folder contains scripts, it is commonly located in Assets/Scripts/Editor

  • Assets/Editor Default Resources folder contains all the resources (asset files) for the Editor scripts. There can only be one Editor Default Resource folder and it must be placed directly inside the Asset folder.

  • Assets/Gizmos folder contains custom Gizmo icons.All custom gizmo's image files must be placed in the Gizmos folder, which must be directly inside the Assets folder.

What is a Gizmo

Gizmos are visual aids that are drawn in the scene view to represent game objects which have no graphical elements and would otherwise be invisible, such as cameras and lights.

  • Assets/Resources folder contains assets that can be loaded on-demand from a script instead of creating an instance. The assets located in the Resources folder can then be called in a script using the Resources.Load function. The Resources folder can be placed within sub-folders inside the Asset folder, and multiple Resource folders can be created. However, it is common to have a single Resource folder directly in the Asset folder and to organize resource assets into sub-folders. If you are using a sub-folder inside the Resource folder, be sure to declare the folder name when using the Resource.Load function.
Use Resource Folder with Caution

When Unity creates a build of a project it automatically checks which assets are required for the build, thereby reducing the build size in comparison to the Unity project file. However, all assets in the Resources folder are used in the build, whether they are being used or not. This could lead to larger build files.

  • Assets/StreamingAssets folder contains any assets in their original format and streamed into the Unity instead of being part of the Unity build. One example of a streaming asset would be a video file from a filesystem.

ASSET FOLDER STRUCTURE#

There are many methods that one can follow when it comes to project folder structure. The most common structure is an asset structure where all assets are organized in folders by the type of asset. Unity projects by default have a Scenes folder, using an asset folder structure all scenes for the project would be placed in this folder. Depending on the project it might make sense to organize assets into sub-folders. For example in the Scenes folder, there could be sub-folders, such as Levels, Menus, and Experimental. Another example would be to have an Audio folder and then sub-folders, for SoundFX and Music.

Asset Folder Structure

Asset Folders and Empty Folders

Asset types might vary by project. The asset folder structure example in this text is based on a 3D game project. However, if the project was a 2D game, you might have a Sprites folder instead of Models and an additional Tiles folder. It all depends on the project. Furthermore, it is best practice not to have any empty folders, so if for example your project does not require any shaders then you should not have a Shaders folder as it would be an empty folder.

ROLE FOLDER STRUCTURE#

A popular variation of the asset structure is to organize assets by development roles. Assets related to art development would go into a parent folder named Art, while assets related to the code would go into a Code folder. Organizing by roles provides a clear distinction on who should be working with which assets.

Asset Folder Structure by Role

Role Organization

Projects with small teams where the members might have multiple roles, organizing by role is not necessary and additional folders can be cumbersome. However, when working with massive teams where an individual might have super-specified roles, organizing by role can be helpful.

FEATURE FOLDER STRUCTURE#

While organizing a project by assets is more common one alternative to this method is to organize by feature. For example, if you are making a space shooter game, in which you have the player ship, enemies ships, a ship cannon, lasers etc. All models, scripts, prefabs, etc. would all be grouped in the folder for that feature.

Feature Folder Structure by Role

Asset Naming Convention

Just as there are best practices for organizing your Unity project there are best practices for naming assets. The example feature folder structure illustrates a common naming convention for assets. For more information see - Project Style Guide.

The feature folder structure can be useful for quickly identifying asset dependencies. Additionally, inside the project window, you can search by asset type, for example, one could search to display all materials in the project. The search-by-type option makes organizing folders by asset type unnecessary.

Asset vs Feature Structure

When first starting out and for new developments, organizing by feature might prove difficult as all features may not be fully identified and there may be a lot of overlap or shared assets. Therefore it is recommended especially for beginners to use the standard asset folder structure.

SETTING UP FOLDERS#

Tutorial Overview

📝Foundational Skills | 🕒10 minutes | 📂Required File: New Unity Project

In this tutorial we will create a basic project folder structure for a new Unity 3D core project, using an asset type folder structure

  1. With a new Unity project open locate the Project window and click the ➕ icon in the top left-hand corner of the window to open the Create menu

Project window create menu

tip

Right-clicking anywhere in the blank area of the folder pane of the project window will also open the Create menu.

  1. From the create menu choose Folder to create a new folder

Create New Folder

  1. Name this new folder 3rdParty. The Project window should look like the following image.

3rdParty Folder

  1. Repeat steps 1 & 2 to create the folders shown below.

Asset Folders

  1. In the Project window double-click on the Media folder to view its contents
  2. Create two new folders one named Audio and the other Video

Media Folder

  1. Double-click on the Audio folder and then create the folders Music and SoundFXs

AudioFolder

  1. Return to the parent Asset folder by clicking on the breadcrumb menu in the folder pane or by clicking on the Asset folder from the navigation pane

Project Window Navigation

  1. Create the following sub-folders using the methods in steps 7 & 8 to create the folders as shown in the navigation pane of the Project window below

All asset folders

Experimental Folder

It is a good idea to have a location to save scenes for testing and experimenting. In this instance, we have created an Experimental folder inside the Scenes folder for this very purpose. The default SampleScene should be moved into the Experimental folder. Furthermore, the Experimental folder could be added to a ignore list when using version control to avoid merging test scenes unnecessarily.

You have now created a basic project structure for your Unity project. Remember as you progress through your development process you should periodically clean up your project folders deleting any empty/irrelevant folders. Likewise, you might need to create other folders as you see fit.


Cited References

  1. Jenkins, J. (2021, October 18). A brief anatomy of a unity project folder. Medium. Retrieved March 29, 2023, from https://medium.com/@jsj5909/a-brief-anatomy-of-a-unity-project-folder-563bd3f4ad40
  2. Prabhu, S. (2018, June 3). Unity3D best practices: Folder structure & source control. ARreverie Technology. Retrieved March 29, 2023, from http://www.arreverie.com/blogs/unity3d-best-practices-folder-structure-source-control
  3. Rivello, S. A. (2021, April 11). Unity - project structure best practices! Medium. Retrieved March 29, 2023, from https://sam-16930.medium.com/unity-project-structure-a694792cefed
  4. Unity Technologies. (n.d.). Special folder names. Unity. Retrieved March 29, 2023, from https://docs.unity3d.com/Manual/SpecialFolders.html