[SOLVED] Properties and Fields: casing in Unity

Correct me if I’m wrong, but it seems that Unity uses camel case for properties and fields whereas the convention is to write fields in camel case and properties in Pascal case.

Thinking about the above, it seems to make more sense to me to use either all camel case or all Pascal case for all public properties and field to easier on the end user. So if you used Pascal for public fields & properties, you’d use camel for private / protected ones.

Thoughts?

I camelCase my fields and PascalCase my properties. A lot of Unity properties(rigidbody, renderer, etc) are being removed in 5, so hopefully there will be less confusion for you.

You missed the point.

We follow the MS convention. Properties are all Pascal case. Fields that are less than public are camel case. That being said - I don’t think we have any fields that are public; or at least very few. We try to expose everything via properties.

1 Like