Game Development Reference
In-Depth Information
The Profiler
This is a Pro-only feature; since most people reading this topic will not have
Unity Pro we won't spend a huge amount of time on it. But it does what its
name says it does—it profiles ( Figure 18.1 ).
The Profiler really is a thing of beauty and can let you know as you're running
the game what's taking the most processing power. Generally, of course,
rendering (drawing the stuff we can see) is what takes the most, but there are
also peaks of scripts taking a lot of resources as well.
The Profiler is available at Window>Profiler, and when the game is run it
provides a real-time histogram of where your resources are going. This can be
very educational to see; for instance, what kind of resources the water takes
when it is being drawn on screen. Or how much of a hit the system takes
when passing through a trigger. Importantly, as the player moves around in
the screen, the Profiler will show which areas are taking the most rendering
power; this can begin to show where textures are the largest or the polygon
count is the highest, and thus provide a hint on where to start optimizing.
Stats
Even if you don't own Unity Pro, standard Unity offers some good tools to see
how hardware resources are being used. In the top-right corner of the Game
window is a Stats button ( Figure 18.2 ). Activating this will provide real-time
stats on what's happening on that frame of the game. Importantly, it will
provide the frame count (in frames per second, fps). Anything below 30 fps
will appear jerky to the player—it's better to be up around 60 fps if possible.
Notice that this little panel also provides a plethora of other information. It
will show Draw Calls, number of tris and verts, and how much texture memory
is being used. All of this can be incredibly valuable as the player walks around.
It can show exactly where—or when you're looking at objects, what—the
biggest drop in frame rate might be. Once the bottleneck regions are located,
much of the art optimization can happen.
Figure 18.1 Profiler in action.
Search WWH ::




Custom Search