Search Unity

Need advice for keeping code organized.

Discussion in 'Scripting' started by Zen-Davis, Mar 23, 2013.

  1. Zen-Davis

    Zen-Davis

    Joined:
    Aug 14, 2009
    Posts:
    285
    We have a team of three coders working together who are relatively new to Unity. One of the gentleman was wondering what the best practices were in regards to keeping the code organized and sharing code between the developers. Would using Subversion be the best practice? Thanks.
     
  2. EliteMossy

    EliteMossy

    Joined:
    Dec 2, 2012
    Posts:
    513
    SVN, GIT, etc would be the best to share code, organization is personal preference.
     
  3. stridervan

    stridervan

    Joined:
    Nov 11, 2011
    Posts:
    141
    In addition to what EliteMossy said,

    * Namespaces
    * Commenting (Very helpful in group scenarios)

    are great for organizing codes.
     
  4. ande04b

    ande04b

    Joined:
    Aug 29, 2012
    Posts:
    119
    I find that when working with together with more programmers on one project, it is important to
    also make good comments in the scripts:

    • Start with a description of what this script does
    • Leave a comment, telling who the author of this script is
    • With each function, leave a comment on what it does
    • Keep nice and consistent spacing between lines of code
     
  5. karljj1

    karljj1

    Joined:
    Feb 17, 2011
    Posts:
    440
    As well as SVN or GIT try to have an agreement between each other on coding style. E.G how you use brackets:

    Allman Style( i like this one )

    Code (csharp):
    1.  
    2. while (x == y)
    3. {
    4.     something();
    5.     somethingelse();
    6. }
    7.  
    GNU Style
    Code (csharp):
    1.  
    2. while (x == y)
    3.     {
    4.       something ();
    5.       somethingelse ();
    6.     }
    7.  
    I find using the same style really helps.
    http://en.wikipedia.org/wiki/Programming_style