Game Development Reference
In-Depth Information
Line 15 in code sample 1-9 is called once per frame. It continually rotates an object 2
degrees around the
y
axis. This code is frame rate dependent, which means that it'll
turn objects faster when run on machines with higher frame rates, because
Update
will be called more often. There are techniques to achieve frame rate independence,
ensuring that your games perform consistently across all machines, regardless of the
frame rate. We'll see these in the next chapter. You can easily check the frame rate for
your game directly from the Unity Editor
Game
tab. Select the
Game
tab and click
on the
Stats
button in the top-right hand corner of the toolbar. This will show the
Stats
panel, offering a general, statistical overview of the performance of your game.
This panels displays the game
frames per second
(
FPS
), which indicates both how
often
Update
is called on your objects and the general performance of your game on
your system. In general, an FPS lower than 15 indicates a significant performance
problem. Strive for FPS rates of 30 or above. Refer to the following screenshot to
access the
Stats
panel:
Accessing the Stats panel for the Game tab to view FPS
There are too many event types to list comprehensively. However,
some common events in Unity, such as
Start
and
Update
, can
be found in the
MonoBehaviour
class. More information on