Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity Organization Standards?

Discussion in 'Community Learning & Teaching' started by MintyAnt, Dec 25, 2012.

  1. MintyAnt

    MintyAnt

    Joined:
    Sep 25, 2012
    Posts:
    6
    Hello,

    I am a programmer who has been using Unity for the past few months. A few days ago, a friend asked me to teach some Designers/Artists on how to best Organize their project, and their (javascript) code. It's just an hour or two with them, once, and then i'm gone. So I want to try and impart the CORRECT knowledge to them, which I admit, i'm not sure what is!

    These people only have a few days of experience with unity, but that time, so I am to give them a high level look at how to best organize their projects.

    I had the following outline so far, and the questions for them follow each:

    1. How to organize your assets folder? I can keep the Scripts folder well organized, but things like Scene files, Images vs Materials, Sounds, etc... I'm a bit confused at the best way to organize each. I would like to know if there is some sort of "Standard" for this, so they may look at it, and possibly use it. Keeping to a standard makes it easier for other unity devs to come in and quickly understand what's happening.
    I do it a lot like this:
    Assets > Scripts
    Assets > Scenes
    Assets > Materials
    etc...

    However, i've seen:
    Assets > Dungeon > Scripts
    Assets > Dungeon > Scenes
    Assets > Dungeon > Enemies > Scripts
    Assets > Dungeon > Enemies > Materials

    What's the general standard for asset organization here?

    2. Javascript, Variable Names, and Functions. As a programmer, I strive to keep my code clean, readable, and commented. Unity is very much along these lines, but there is 'some' uncertantity, and again, I would like to know the standard way.
    What should the public variables be named? The private? My variables are always hungarian "mVarName" but this gets screwy with the Unity Editor, coming out as "MVarName" in the editor. Plus, some people hate hungarian.
    Function Names? I always do "FunctionNameHere()", but i've seen unity docs to "Function_NameHere" or "functionNameHere" somesuch. What's the general concencus on this guy?


    3. Breaking up your components. In my latest project, I had a player with many scripts on him. He had a Health script, Attack script, PlayerController and SideScrolling script, Aggro script (ammount til he goes into super mode), etc.
    I found this a lot more organized that one script to rule them all, but Unity examples seem to do that! Others, like the player controller, have sub-objects within the script that you define.
    Is there a good guide on this, on how to break up your scripts properly for your object?

    Thanks for your help guys, hopefully posted in the right sub-forum.
     
  2. Socrates

    Socrates

    Joined:
    Mar 29, 2011
    Posts:
    787
    1) I like creating a project where under Assets I have a "My Project Name" folder and then folders such as Scripts, Models, Textures, Materials, Scripts, Prefabs, and whatever other types of files I need in them. I do this because that way when I import a package or asset, I know it's not dropping files I don't notice in among the files I have created.

    2) Naming conventions (and file formats like where to put the brackets) are something that people will argue and debate because they can be as strongly held views as politics. Overall, pick a consistent style for the project and have everyone stay with it.

    3) I agree on multiple scripts. It makes debugging and changing out modules a lot easier. It can be overdone, and some projects will be easier if you don't split two closely related aspects into different files. I program in C# generally, so I tend to think along the lines of one class, one file, one component.
     
  3. Nubz

    Nubz

    Joined:
    Sep 22, 2012
    Posts:
    553
    What ever way they feel like it so it makes sense to them where and what everything is I would think