The Unity convention is actually rather simple: everything is Pascal-cased, types (classes, structs, enums) and methods start with upper-case, fields and properties with lower-case. Enum values in upper-case, constants in lower-case (usually). So ClassName
, MethodName
, myField
, myProperty { get; set; }
, MyEnum.CaseA
… that’s it.
As for your example, Transform
is a class, whereas transform
is an accessor to the instance of Transform
in that particular GameObject/Component. Also, Transform
doesn’t have a Position
property, it has a position
property (always lower-case).
This is more or less based on C#’s conventions and the standard .NET library (MS has very precise guidelines about it), except standard .NET uses UpperCase for public/protected methods AND properties, and lower-case for private (again, usually; what’s private is more left to the taste of the coder I think).
As a side-note, with any codebase, in any language, the best way is ALWAYS to follow the existing convention. Every seasoned programmer will tell you this. I understand about OCD, believe me, but in this case I suggest you let it go. There are very little objective arguments as to why a convention would be better than another (by definition a convention is arbitrary), and even if there was, the absolute worse thing you can do is mix several conventions, because then you have 0 convention at all and never know what to expect.
At least C# tries to standardize; I’ve worked on several C++ codebases and I fail to see a common denominator: UpperCaseClassNames
, lowerCaseClassNames
, underscore_separated
, tClassName
, ENUMS_IN_UPPER
, or not… it’s rarely consistent, so the less you mix the better.