Game Development Reference
In-Depth Information
10.
Stop Play mode.
Comment out the
counter
and
print
lines in the
Update
function by adding
two backslashes in front of them:
11.
//counter++; // increment the counter by 1
//print (counter);
Having commented out the two counter lines, you will soon discover that Unity will warn you, via the
console, that the variable
counter
is never used. For efficiency, you should comment it out as well.
Comment out the
int counter = 1
line as well:
12.
// int counter = 1;
13. Save the script.
A common task to perform in the
Update
function is a
transform
. Remember transforms are move,
rotate, and scale. Let's have some fun with the bench.
1.
Set the coordinate system to Local.
2.
Select the bench, and set its Y Rotation to 180 degrees so that its local Z
points toward the gate opening (Figure
5-39
).
Figure 5-39.
The bench “facing” the opening