Naming Conventions | Unity Developer
As I have been working on my space shooter game, there have been a few bugs and problems that I was making mental notes of to check back on later to touch up and fix. Since I recently completed adding some different attacks for the enemy boss, it seems like a good chance to go back and tackle some of the problems I was noticing.
They say that consistency in programming or coding is one of the most important things to keep in mind. Which is why I am ashamed to say that I didn’t stay consistent when it comes to the naming conventions of my variables during my first take at my space shooter game.
C# naming conventions typically follow the standards set by Microsoft. Thier guidelines recommend the use of PascalCase and camelCase. As you can see from how the letters are capitalized, PascalCase has the first letter of each word capitalized. PascalCase is used primarily for methods and functions.
camelCase, which can also be referred to as lower camel case, is when the first letter of a variable is lower case. If the variable is made up of multiple words, the first letter of the first word is lower case.
As an independent developer, you may think that it doesn’t matter how the variables and methods are spelled out, especially if the code works as intended. However, if you’re working with a team or a large studio, it’s important to stick to the naming conventions that they set out for you. Reading code is easy for some, but it becomes easier if it is consistent throughout the entire program.
Get Derek Anderson’s stories in your inbox
Join Medium for free to get updates from this writer.
In order to put this into practice, I spent some time fixing up the naming conventions of my variables in my space shooter game. It’s a simple fix, but it’s one issue that can easily be avoided.
In my program, underscores were used to denote private variables, but for whatever reason, I missed putting them in initially. Time to fix that.








