Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Unity Project Style Guide

Discussion in 'General Discussion' started by stillwwater, Jun 11, 2018.

  1. stillwwater

    stillwwater

    Joined:
    Feb 8, 2016
    Posts:
    11
    I wanted to share the style guide we are currently using for general project structure and asset naming conventions. It has ideas gathered from forum discussions and things that worked for us in previous projects.

    link: https://github.com/stillwwater/UnityStyleGuide

    What conventions do you use to keep your assets organized and easy for programmers and artists to work with?
     
  2. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    I really liked this + 1
     
  3. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,500
    I suggest putting a "_" before "_Art", "_Audio", etc... so that go on top and you do not get confused with the incoming folders from outside. For example Assetstore add-ons.

    idea for frequently used assets: if you need to be on top as for example "__Scene" you can use 2 "__"
     
    theANMATOR2b, TonyLi and Murgilod like this.
  4. BitsAtPlayDev

    BitsAtPlayDev

    Joined:
    May 5, 2013
    Posts:
    11
    I love stuff like this.

    Getting back into Unity after a few years away, I'm very interested how others setup their Unity projects. :)
     
    stillwwater likes this.
  5. stillwwater

    stillwwater

    Joined:
    Feb 8, 2016
    Posts:
    11
    Same here, I wish more people would share how they organize their files!

    I think a lot of people overlook project organization when starting a new game, and when their project gets large the mess becomes unproductive.
     
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,526
    Similar to Alan Mattano's suggestion, I prefer to put all project-specific files in a folder named "__Game" or "__Project" with two underscores, since some Asset Store products import into folders with a single underscore. This keeps your files separate from third party assets and always available at the top of the Project view.

    Unity's Spotlight Team has some excellent Best Practices posts, such as William Armstrong's Project Setup. Charles Hinshaw's article has good advice, too, such as firewalling what you don't ship. But the single best article I've come across is Valentin Simonov's What NOT to do in Unity: the most common mistakes to avoid. Some great advice that jumped out at me:
    • Identify your requirements (target devices, rendering/CPU budgets, etc.) before creating the project.
    • Start a new project from scratch after initial prototypes.
    It also includes excellent advice for asset settings; programming; and CPU, GPU, & UI performance.

    My own advice is to identify the rough "shape" of your project -- Will it be heavy on art assets? Contain a lot of code? How many team members? etc.

    If you expect a lot of code, use assembly definition files, or even separate projects that compile into DLLs. (Also set up tests. They'll will save you way more time than your initial investment.)

    If you expect a lot of art assets, use asset bundles in separate projects, and implement them as early as possible. It's a real hassle to restructure your project after the fact to use asset bundles.

    I've consulted on some 100 GB projects with many thousands of lines of code (set up that way before I got there). It's no fun when a single script change triggers a 5 minute recompile. And if Unity has to reimport the project for some reason, it's time to take the afternoon off while it cranks away.

    Don't bother doing either of these for your prototype projects, but certainly consider them for your production projects.


    One thing that I haven't seen consensus on is grouping related assets. Some teams like to do this:

    __Game/
    Models/
    Dragon.fbx
    Orc.fbx
    Textures/
    Dragon.psd
    Orc.psd
    Materials/
    Dragon.mat
    Orc.mat
    Prefabs/
    Dragon.prefab
    Orc.prefab

    And others like to do this:

    __Game/
    Dragon/
    Dragon.fbx
    Dragon.psd
    Dragon.mat
    Dragon.prefab
    Orc/
    Orc.fbx
    Orc.psd
    Orc.mat
    Orc.prefab

    I tend to prefer the latter. What are other people's thoughts?