Brackeys / 2D-Character-Controller

Free 2D Character Controller for Unity.
https://youtu.be/dwcT-Dch0bA
1.16k stars 1.62k forks source link

Naming Convention #8

Open zanqwq opened 5 years ago

zanqwq commented 5 years ago

What's the naming convention means by starting by m and k?

FanSeaJay commented 4 years ago

I'm new, but I think it might make it easier to call on those functions in the future as all you have to do is type "m_" and then it should provide you with all of the things you have named that way.

WaltersAvenger commented 4 years ago

m is a prefix for a global variable (variable that can be accessed in the entire script across multiple sub routines.) k is a prefix for constants.

S1Zr commented 4 years ago

m = member k = constant (Even though I have not read the k-variant before)

Read Hungarian notation: https://en.wikipedia.org/wiki/Hungarian_notation It makes it fast to see what type of variable it is by name, but with moderns languages and editors makes the Hungarian notation a bit outdated. But once in a time, useful.

always writing "" or "m" as prefix for a member variable could be replaced with "this." i java or c#, but that is even more to write, so "m", "" or "m_" is quite common even now 20+ years later. :)