Search Unity

come on.. fix the inspector variable names

Discussion in 'Scripting' started by Crisium, May 21, 2011.

  1. Crisium

    Crisium

    Joined:
    Aug 7, 2010
    Posts:
    67
    Unity3D looks very promising... been doing some really nice stuff the with it the last 4-5 days.... but but but... why
    do you have to reformat the variable names in the inspector? this is causing wasted time debugging just to find out that I have the wrong case with my variable.

    On top of that you also put spaces in the inspector variables.. why? oh why? is this a Steve Job thing?

    Peter Wraae Marino
     
  2. BlackHawkStudios

    BlackHawkStudios

    Joined:
    May 1, 2011
    Posts:
    107
    I find it that this system is the best, plus you can make it where it doesn't put spaces in the inspector. Example: "theDog" > "The Dog" by "thedog" >"Thedog"
     
  3. Crisium

    Crisium

    Joined:
    Aug 7, 2010
    Posts:
    67
    well. would be nice if you could tell me where I could turn off this unwanted feature.

    regards,
    Peter
     
  4. KyleStaves

    KyleStaves

    Joined:
    Nov 4, 2009
    Posts:
    821
    I don't believe it can be disabled; what BHS is saying is that if you refrain from using camel or pascal case variable naming, you can break the system.

    It's not really a good solution though, because it would also break camel/pascal case intellisense in addition to hindering the readability of your code.
     
  5. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,090
    dumbest complaint ever.
     
  6. Crisium

    Crisium

    Joined:
    Aug 7, 2010
    Posts:
    67
    dumbest reply ever.
     
    JackS1001 likes this.
  7. BlackHawkStudios

    BlackHawkStudios

    Joined:
    May 1, 2011
    Posts:
    107
    I believe the system is good. As does 95% of the community. If you would like something done with it, for that 5% suggest it to the developers.
     
  8. Crisium

    Crisium

    Joined:
    Aug 7, 2010
    Posts:
    67
    Please tell me why it is good? I have to open the scripts to find out what the actual case is, because it IS case sensitive! why is it good that unity breaks this in the inspector?
     
  9. KyleStaves

    KyleStaves

    Joined:
    Nov 4, 2009
    Posts:
    821
    I think it's popular because it's very readable, and best practice suggests that you use the same naming convention for all your variables anyway... if you name all your variables of the same scope with the same convention you shouldn't ever have to open the class to check what the "real" name is anyway.

    For instance, my classes all look like this:

    Code (csharp):
    1.  
    2. public class ExampleClass {
    3.      public string _classString;
    4.      string _privateClassString;    
    5.  
    6.      void ExampleMethod(string parameterString){
    7.           string localString = parameterString;
    8.      }
    9. }
    10.  
    Sure, in the editor it would show up as "Class String" and not "_classString" - but I know the naming convention I use, so I know the variable name...


    EDIT:
    Out of curiosity, what IDE are you using? Anything with intellisense would remove this concern anyway.
     
  10. Crisium

    Crisium

    Joined:
    Aug 7, 2010
    Posts:
    67
    couple replies:

    1. I have yet seen a programmer stick with a naming convention (we adapt as needed)
    2. Why should it be readable??? you are scripting this is not the name being given to the end user? you are the one working on a project and the variables should be shown in the case they are defined.... otherwise Unity3D should remove case sensitivity.
    3. I'm using the default IDE that is supplied with Unity3D.. called something like "UniSciTE" ... I think it's an ok ide... better than notepad :)
     
  11. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    While I agree that there should be an option to turn off the feature, your points don't really make a proper argument.

    2) Readability in code is actually important. Do you name your variables like asdfi398dfjnasdeei834kjd?
    3) Don't use the default IDE especially if you're working in C#. Just use MS Visual Studio 2008 or at least MonoDevelop (which is also supplied with unity)
     
  12. Ezzerland

    Ezzerland

    Joined:
    Jul 1, 2010
    Posts:
    405
    Also, in what language and on what OS are you programming in? There are some awesome user-made additions that may be very helpful toward this issue, for unityscript and Windows..

    The main reason I find it useful the way it is:
    When I sell a script, and someone implements it in their game. They are able to clearly read the variable names and judge a meaning of that variable without opening the code and looking. It makes it very clean for drag+drop scripts and especially for beginning developers.

    As Kyle mentioned above, I also use one standard format for all my variables, so for me this is no hassle at all.

    Edit-
    I also believe this should be under Unity Support ;)
     
  13. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    If you don't like it, make your own Custom Inspector for everything. It's a fantastic system, and this is the first complaint I've seen in four years.

    If you're the one doing everything, and you're so code-focused, then don't use the Inspector for anything! Get to the point where you have something you want to sell on the Asset Store, and see how many customers like looking at camelCase outside of code. :p
     
    Last edited: May 21, 2011