Frame timing API counter reference
GPU Usage Profiler module
Rendering Profiler module referenceThe Rendering ProfilerA window that helps you to optimize your game. It shows how much time is spent in the various areas of your game. For example, it can report the percentage of time spent rendering, animating, or in your game logic. More info
See in Glossary displays rendering statistics and information about what the CPU and GPU do to render the SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary. You can use these statistics to measure the resource intensity of different areas of the Scene, which is useful for optimization.
To open the Profiler window, go to menu: Window > Analysis > Profiler.
The chart displays the number of Batches, SetPass Calls, Triangles and Vertices your application rendered. The lower pane displays more rendering statistics, which match the ones shown in the GameView Rendering Statistics window.
The Rendering Profiler moduleThe Rendering Profiler moduleâs chart is divided into four categories as follows:
Chart Description Batches Count The number of batches Unity processed during a frame. SetPass Calls Count The number of times Unity switched which shaderA program that runs on the GPU. More infoWhen you click on the Rendering Profiler module, the details pane in the lower half of the window displays detailed rendering statistics. These statistics are similar to the statistics shown in the Rendering Statistics window.
In the top left of the details pane, select Open Frame Debugger to open the Frame Debugger, which gives you information on individual drawcalls that rendered the frame.
These statistics are also available via the ProfilerRecorder API and in the Profiler Module Editor so you can add them to a custom Profiler module.
Statistic Description Accessible in Release Players SetPass Calls The number of times Unity switched which shader pass it used to render GameObjects during a frame. A shader might contain several shader passes and each pass renders GameObjects in the scene differently. Yes Draw Calls The total number of draw calls Unity issued during a frame. Unity issues draw calls when it renders GameObjects to the screen. This number includes non batched draw calls as well as dynamic and static batched draw calls. Yes Batches The total number of batches Unity processed during a frame. This number includes both static and dynamic batches. Yes Triangles The number of triangles Unity processed during a frame. Yes Vertices The number of vertices Unity processed during the frame. Yes (Dynamic Batching) This section contains statistics on dynamic batchingAn automatic Unity process which attempts to render multiple meshes as if they were a single mesh for optimized graphics performance. The technique transforms all of the GameObject vertices on the CPU and groups many similar vertices together. More infoThe Rendering module Profiler countersPlaced in code with the ProfilerCounter API to track metrics, such as the number of enemies spawned in your game. More info
See in Glossary are also available in Players. Use the ProfilerRecorder API to access Render Profiler module information in Players. High level counters are also available in Release Player.
The following example contains a simple script that collects SetPass Calls Count
, Draw Calls Count
and Vertices Count
metrics and displays those as TextArea.
using System.Text;
using Unity.Profiling;
using UnityEngine;
public class RenderStatsScript : MonoBehaviour
{
string statsText;
ProfilerRecorder setPassCallsRecorder;
ProfilerRecorder drawCallsRecorder;
ProfilerRecorder verticesRecorder;
void OnEnable()
{
setPassCallsRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Render, "SetPass Calls Count");
drawCallsRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Render, "Draw Calls Count");
verticesRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Render, "Vertices Count");
}
void OnDisable()
{
setPassCallsRecorder.Dispose();
drawCallsRecorder.Dispose();
verticesRecorder.Dispose();
}
void Update()
{
var sb = new StringBuilder(500);
if (setPassCallsRecorder.Valid)
sb.AppendLine($"SetPass Calls: {setPassCallsRecorder.LastValue}");
if (drawCallsRecorder.Valid)
sb.AppendLine($"Draw Calls: {drawCallsRecorder.LastValue}");
if (verticesRecorder.Valid)
sb.AppendLine($"Vertices: {verticesRecorder.LastValue}");
statsText = sb.ToString();
}
void OnGUI()
{
GUI.TextArea(new Rect(10, 30, 250, 50), statsText);
}
}
The Rendering Profiler module information belongs to the ProfilerCategory.Render Profiler categoryIdentifies the workload data for a Unity subsystem (for example, Rendering, Scripting and Animation categories). Unity applies color-coding to categories to visually distinguish between the types of data in the Profiler window.
See in Glossary.
If you want to highlight the selected Rendering counters in a custom module, use the Module Editor to configure the chart and detailed view.
Additional resourcesFrame timing API counter reference
GPU Usage Profiler module
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4