Game Development Reference
In-Depth Information
Every game has a frame rate, which is defined in frames per second ( FPS ). This rate
is viewable from the Stats panel in the Game tab. The FPS tells you how many times
in 1 second Unity is able to loop or iterate through your game code to draw a new
render from the cameras to the screen. Each iteration is called a frame . The frame
rate varies dramatically over time and across different computers. It's influenced
by the power of your computer, other processes that might be running, and by how
much content it needs to render in the current frame, among other factors. This
means you can never rely on FPS being consistent over time or the same across
different computers; there'll often be a different number of FPS. Have a look at
the following screenshot:
FPS is important for the creation of time-based behavior and animations
To approximate the concept of a frame, Unity offers three class events that every
MonoBehaviour class can implement to perform functionality that must continually
update or change over time. These events have already been seen, but now, we'll
consider them in more depth, specifically Update , FixedUpdate and LateUpdate :
Update : The Update event is called once per frame for every active
component on every active GameObject in the scene. If an object is
deactivated by the MonoBehaviour.SetActive method, then Update events
will not be called for that object until it is activated. In short, the Update
event most accurately represents the concept of a frame in Unity, so it's
useful for performing repetitive behaviors or functionality that must be
updated and monitored over time, such as player input events, keyboard
presses, and mouse clicks. Note that the order in which Update events are
invoked across all components for each frame is not guaranteed; that is, you
cannot be sure whether the Update function on object X will be called before
that on object Y during any one frame.
 
Search WWH ::




Custom Search