Using multiword variable names

Let's use the same example again, as follows:

public bool areRoadConditionsPerfect = true;

You can see that the variable name is actually four words squeezed together. Since variable names can be only one word, begin the first word with a lowercase and then just capitalize the first letter of every additional word. This greatly helps create descriptive names which the viewer is still able to read. There's a term for this, called camel casing.

I have already mentioned that for public variables, Unity's Inspector will separate each word and capitalize the first word. Go ahead! Add the previous statement to LearningScript and see what Unity does with it in the Inspector panel.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset