Game Development Reference
In-Depth Information
Figure 5-37.
The new code in the
Update
function, nicely indented for readability
6.
Save the script.
7.
Drag the new script onto the StoneGardenBench object in the Hierarchy
view.
8.
Select the bench, and look for the new Update Tests component in the
Inspector.
As expected, the counter variable is not exposed.
9. Open the console tab, and click Play.
Because the
Update
function is called every frame, the console is flooded with the printouts
(Figure
5-38
).
Figure 5-38.
The counter printouts from every frame in the console