Have you ever faced a problem that it was hard to find assets in your project? If you’re new to Unity and make a game more complex than Space Invaders, the answer is probably yes. That’s exactly what happened with our team. We are working on a big 3D MMO game and three months ago we decided that our project requires restructuring. In this post, I’ll show a folder structure that we use, explain how it is connected with an art production pipeline and describe some naming conventions that help us a lot.
After a few hours of googling I found several topics about project structure best practices:
All these posts describe very simple cases (suitable for small games) and some basic rules of assets organisation. So we decided to create our own set of rules. Now, after several iterations of folder restructuring we are ready to share them.
Assets Folder Structure
When we started restructuring, we had two simple goals: root folder should be as clean as possible, and folder structure should be ready for Asset Bundles. Below you can find a screenshot of our project window and explanations to some folders.
/DynamicAssets/[asset bundle id]/Resources – a place to put assets dynamically loaded via
Resources.Load(...) method. Common folder contains only base resources packed with game. Resources from other folders are compiled into Asset Bundles and loaded from our servers on demand. Note, if you’re not using asset bundles you can only have one
/Extensions/[extension name] – by default, all third party extensions like NGUI are unpacked to the
Assets folder root. But after fifth extension you’ll get a mess in the project, so we have decided to create a separate folder.
/StaticAssets – when we’ve just started our game we used folder structure described here. After four months of development we realised that it’s a total mess in the root, so we moved all static resources (referenced directly from scenes) to the separate folder.
/StaticAssets/Animations – to understand a hierarchy related to animations better I’d like to describe a part of our art pipeline (note, we use Mecanim):
- animator imports animations into Unity in
.fbxformat and puts them under
- animator duplicates all the
.fbx, configures them and moves to
- animator creates mecanim animator controller for specific model, puts it under
/StaticAssets/Animators, configures mecanim state machine using
/StaticAssets/Effects – folder for models, materials, textures, prefabs, etc. used for particle systems.
Don’t use spaces in file and folder names. We faced with this problem during a project build setup on CI server, as we found Unity3D [command line tools][comand-line-tools] can’t automatically process paths with spaces.
- Append prefixes to differentiate asset types, e.g.
scn_– for scenes. We started to use prefixes when we discovered that it was easy to confuse prefab with model. Another advantage of this approach is instead of typing
t:Prefab Bearin search field you type
pref_Bear, which is shorter
- Folder structure under
/DynamicAssets/[asset bundle id]/Resourcesis exactly the same and almost the same as under
More naming conventions you can find in this post under “Naming Standards and Folder Structure” section.
More posts from Mastering Unity Project Folder Structure series:
Share with: Google+ • Twitter • Facebook