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:
- 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?
-
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? -
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.