Coding Standards?

The way I code is a little different than what I guess most people code like. For instance when I see:

public float walkSpeed;
public float jumpSpeed;
public float gravity;

Mine would be:

public float _walk_speed;
public float _jump_speed;
public float _gravity;

Now my reasoning behind this is that the beginning underscore shows that you are directly accessing a object member. Now if I want to make the member private and give a property for it, the beginning underscore allows me to do:

private float _walk_speed;
public float walk_speed
{
    get{ /*code...*/ }
    set{ /*code...*/ }
}

The issue is that with public member, in the editor it shows up like

Walk _speed

Is there anyway to get the editor to generate names based off of a specific coding standard?

I think this is the Unity way

private float m_walkSpeed; 
public float walkSpeed 
{ 
    get{ /*code...*/ } 
    set{ /*code...*/ } 
}

The “m_” will be hidden in the editor
In the Inspector it will appear as

Walk Speed

ok (it also seem that _walkSpeed works too) but is there a way for thing to show up correct with the none unity way or to show the name exactly how it appears in the script (I rather see “_walk_speed” than “Walk _speed”).

perhaps using m_ before _walk_speed will work

m__walk_speed

I would however encourage you to conform to unity’s conventions

Look into Hungarian Notation. I don’t use it myself but many do.

Hungarian notation is considered invalid in .Net, and should generally be avoided.

Use what convention works best for you ( research and try many first ), but the important part is to stick with it.

-Jeremy

I have a convention that I have been using (whenever possible) that works for me for the past at least 5 years but that is going to make thing in Unity inspector look kinda weird.

Yeah, but you have to weigh the importance of nice inspector output against the importance of using whatever standard you are used to.

You are going to be looking at code more than the inspector, so it’s usually a good plan to make the programming side go as smooth as possible.

-Jeremy