Why do you have properties with a small letter?

5341125--539088--upload_2020-1-6_15-48-2.png

Hello, there is a C# naming Convention from MSDN.

There are properties with a capital letter.

I wanted to know the reason why you and the little one? Or I something not so understood?

1 Like

Its just preference. paramenters start with lowercase letters, and Methods start with UpperCase

Heres the msdn guidelines

You can use whatever conventions you like in your own work, but the most important thing is readability

1 Like

When you’re on a project with multiple people, generally you’ll follow a coding standard which covers this topic. But for your own project it doesn’t matter much so long as you’re consistent with whatever your preference is. Personally I start with capital for public, lowercase for private or local, for both variables and methods. I picked that up long ago and have always liked it. Other people like other things, and you can’t really say someone is wrong for liking something :stuck_out_tongue:

Maybe this developer came from Java, where you generally have members lowercased.

It’s Unity scripting conventions.

  • small letter for a public variable: gameObject,

  • m_ followed by a Capital letter for private variables: m_GameObject.

Can you link those conventions?

Also, the members in OP are properties, not private or public variables.

Microsoft’s code conventions are a recommended starting point for people who don’t already have an established coding convention. For people who already have an established convention it doesn’t make any sense to suddenly drop it just because the language recommends a different one. Consistency is more important than the style you went with.

As others have pointed out it’s just a preference thing, I do things a little differently with my code as well and with my naming conventions. I don’t like the way for example that so many programmers just completely ignore defining an empty as an empty. So what I do to help me identify all that in the hierarchy and make linking public gameobjects for example easier is I label my empty FPSController as FPSControllerEmpty so that I know exactly what is what in the hierarchy and I don’t confuse myself and I know how a code is going to act especially if I start rotating the gameobject and so on using code.

There are all sorts of situations where it’s just good practice to make it clear you’ve done your own custom functions and so on especially if you’re working on a big project.

https://learn.unity.com/tutorial/player-character-part-2-the-script?projectId=5caf65ddedbc2a08d53c7acb#5caf6e8cedbc2a08d53c846a, scroll down to “Naming Conventions”.

I read too fast, properties should take upper case first letters but to each their own, I guess.

It’s preferential. I also use lowercase for public and private variables (as said above, like in Java), simply because methods and classes are already first letter uppercase.
For object instantiation, GameObject GameObject or Entity Entity is, to me at least, not really readable. I like being able to say in notepad what is what and I’m working with my own conventions that I use for every languages I’m working with.