Assets Folder Structure

Hello everyone, in this post, I would like to share with you the way that I organize my Assets folder, and that has worked very well for all my games.

.
├── YourGame
│   ├── Scenes
│       ├── Scene1
│           ├── Fonts/
│           ├── Scripts/
│           ├── Textures/
│           ├── Materials/
│           └── ...
│       ├── Scene2/
│       ├── SceneN/
│       ├── Shared/
│       ├── Scene1.unity
│       ├── Scene2.unity
│       └── SceneN.unity
│   └── Tools
│       ├── EditorTool1
│           ├── Editor/
│           └── ...
│       ├── EditorTool2/
│       └── EditorToolN/
├── FromAssetStore1/
├── FromAssetStore2/
├── FromAssetStoreN/
├── Gizmos/
├── StreamingAssets/
└── ...

If you have any suggestions, please leave them in the comments.

Hi,

How do handle fonts and other assets that are shared among multiple scenes?

Each tool has its own Editor folder. This used to be a reasonable way to organize scripts. However, if you use assembly definitions to speed up compilation and enforce modularity, you’ll probably want to put all your editor scripts in one folder. Otherwise you’ll end up with too many asmdefs, and it will slow down compilation.

For this, use the following folder: Assets/YourGame/Scenes/Shared

In this case, you can have a mix of the two ways, like on Unity FPSSample.

.
├── Tools
    ├── Editor          #asmdef
        ├── EditorTool1/
        ├── EditorTool2/
        ├── EditorToolN/
    ├── EditorTool1
        ├── Editor/
        └── ...
    ├── EditorTool2/
    └── EditorToolN/
└── ...
1 Like

Good job. I like how you also acknowledge that Unity has some special folder names that can’t change, such as Gizmos, StreamingAssets, etc.

1 Like

I usually write it like this for bigger projects:

- 0 MyFiles // "0" so it is always the topmost folder
--- 0 Core // things that are used among the whole project, like extensions, editor scripts, ...
----- Scripts
--- Player
----- Scripts
----- Models
----- Textures
----- ...
--- Enemy
----- Scripts
----- Models
----- Textures
----- ...
- FromAssetStore1
- FromAssetStore2
- ...

“Enemy” and “Player” are systems, such as “UI”, “Environment”, “Weapons” and so on, and everything related to it can be found in their specific folder or the folder further up, for example:
Inside “Weapons”, there are 8 different weapons, but two of them (“Pistol” and “Rifle”) share the same sound file, then it can found in “Weapons/Sound” instead of “Weapons/Pistol/Sound” or “Weapons/Rifle/Sound”.
If there is no top folder, like for “Player” and “Enemey”, but both use the same animations, a new folder will be created, in this case “HumanoidCharacter” - where animations are stored.

And for smaller ones like this:

- 0 MyFiles
--- Scripts
--- Models
--- Textures
--- ...
1 Like

There isn’t a one fits it all folder structure in my opinion but I have a few fundamentals that I follow.
I have projects that only have a Content folder with some assets in that and some that have 4 Levels of categorization of assets. But usually, I try to keep the folder structure as flat as possible. Once I find myself having too many objects in one folder that are not of the same purpose then I create subfolders.

For instance, a folder of country flags is fine in one folder. But 100 UI Prefabs I would categorize in Sliders, Buttons etc.

Also, I make use of CustomImporters sometimes, for example, to define the content of AssetBundles by location or to mark all images that are imported to a “Sprites” folder are automatically imported as Sprites.

Code
    Core
        Main.cs
    Game
    UI
    Helper
    Testing
    IO
Content
    ThirdParty
        AssetPackage1
        AssetPackage2
    Models
        Buildings
            BuildingA
                Materials
                Textures
                Animations
                Model1.fbx
                Model2.fbx
            BuildingB
        Characters
    Materials
    Textures
    Sprites
    GUI
        Sprites
        Animations
        Prefabs
        Textures
Editor
    Content
    Code
        Inspectors
        EditorWindows
Scenes
StreamingAssets
ThirdParty
    SomeAPI
        API.dll
    FromAssetStore1
    FromAssetStore2