Folder Structure in Unity

I’ve been working with Unity for more than a year and part of the experience was trying to come up with a standard workflow for all my projects.

The first thing I established was how to configure a repo (specifically, git)  to work along with Unity. And even so, I’ve updated the .gitignore file many times to fully tackle every new thing that comes up.

The second thing that has always been bothering me was the folder structure inside the Assets folder of Unity (the one that shows inside Unity as a Project tab). I’ve been thinking what’s the best way to categorize the assets for a project and here some of them.

The first idea is to separate assets according to their source and later by their type.

  • Assets
    • 3rd Party Assets
      • <A 3rd Party>
      • <Other 3rd Party>
      • <Another 3rd Party>
    • Core Assets
    • Sample Assets
    • Plugins

Each of the leaves of that folder tree should have the following structure:

  • <Folder>
    • Audio
      • Music
      • SFX
    • Editor
    • FX
    • Materials
    • Meshes
    • Prefabs
    • Scenes
    • Scripts
    • Textures

This works as follows. The 3rd Party Assets folder is where all the assets you find on the web go; say you found a script, from developer , that moves stuff randomly on-screen, the idea is to create a folder for it inside this global folder. (There’s one 3rd Party plugin that so far is the only one that doesn’t work with this approach: Facebook.)

Any other assets that are built by the developers of the project should go inside the Core folder. And finally, the same goes to Unity’s Standard Assets (soon to be renamed into Sample Assets), where everything that comes from the preloaded assets from Unity goes.

The goal of this approach is to separate everything by source, which means that if you’re working with a solution you found on the web, and you want to replace it or remove it, it’d only be needed to delete its corresponding folder inside the 3rd Party Assets. No need to jump around the folders to find what belongs to what. The inner folder structure (sorting by asset type) is pretty easy to understand, so I wont dwell further into that.

However, this is not the only or best solution. You could also order things first by type and then by source, but this means that if you want to delete something from a 3rd Party, you’d need to search each folder.

One last solution that comes to my mind is an Object-based approach. You create a folder for each object in the game (say, a Soldier folder), where everything related to that object is put together (you could order things by asset type if you will). The interesting thing about this approach is that deleting an object is easy: you just delete its folder. Its shortcoming is that many objects can share a same asset, so a Common folder should be needed to put everything that’s not object-bounded.

You could also use a mixed approach of different solutions. I decided to work with the first idea: to order things first by Source and then by Type. But, ultimately, it all depends on your needs and OCD level.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.