Game Development Reference
In-Depth Information
Figure 5-9. The script editor after removing the semi-colon from line 7
This time, the error message may be less helpful (Figure 5-10 ). Without the semi-colon to signify the
end of the line, the compiler reads the two lines as one. When a curly bracket, parenthesis, or semi-
colon is missing, you may have to backtrack to find the problem.
Figure 5-10. The somewhat less than helpful message in the status line
10.
Replace the missing semi-colon.
11.
Save the script.
Let's take a look at the new variables in the Inspector.
1.
Select any one of the three gameObjects that contain the Variables Test
component.
2.
Check out the new variables in the Inspector (Figure 5-11 ).
Figure 5-11. The new variables exposed in the Inspector
The variable names that used CamelCase have had spaces inserted and, just like the legs variable
have had the first character capitalized. A convention in Unity is to use lowercase characters for
variable names' first character. They cannot start with a number or certain special characters.
Variable names may also not contain spaces. Just as with the script names, use CamelCase
or underscores to make the variable names more readable. Ideally, variable names should be
meaningful without being too long or difficult to read.
 
Search WWH ::




Custom Search