Skip to content
Tutorials Center
My learning

Topics

Lesson 34 of 38 ยท Packaging and Performance

Profiling and Stat Commands

Find performance problems in Unreal Engine. Frame budgets, stat fps, stat unit, stat gpu, view modes, Unreal Insights and how to tell game thread, render thread and GPU bottlenecks apart.

"The game feels slow" is not a bug report you can act on. To fix performance you must measure: find out which part of the frame takes too long, then change that part and measure again. Unreal Engine includes console commands and tools that show where the time goes.

The Unreal Editor is not available on this site, so the commands are described precisely and the Python stand-ins model the arithmetic of frame budgets and bottlenecks.

Frame budgets

A frame must finish within a fixed time to hit a target frame rate:

Target Budget per frame
30 fps 33.3 ms
60 fps 16.7 ms
90 fps (VR) 11.1 ms
120 fps 8.3 ms

Think in milliseconds, not fps: fps is non-linear, so losing 5 fps near 60 is a smaller problem than losing 5 fps near 20. The budget is shared between threads that work in a pipeline.

Python Stand-in: frame budget calculator

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The console

Press the backtick key (`) in the editor viewport or a development build to open the console, then type commands:

  • stat fps shows frames per second and frame time.
  • stat unit shows milliseconds for Frame, Game (game thread), Draw (render thread), GPU, and others. This is the most important command.
  • stat unitgraph plots those values over time.
  • stat gpu breaks GPU time down by pass (base pass, shadows, Lumen, post process).
  • stat scenerendering shows draw calls and primitives.
  • stat engine shows triangle counts and other counters.
  • stat memory and memreport -full list memory by category.
  • stat game shows game thread cost (Blueprint and tick time).
  • stat none turns all stat displays off.

Other useful commands: t.MaxFPS 60 caps frame rate, r.ScreenPercentage 70 renders at lower resolution, show Foliage toggles features, r.VSync 0 removes V-sync, and profilegpu captures a detailed GPU frame (Ctrl+Shift+, in the editor).

Finding the bottleneck

The three big numbers from stat unit are:

  • Game: CPU time running gameplay (Tick, AI, physics gameplay logic, Blueprints).
  • Draw: CPU time preparing draw calls on the render thread (many objects, many materials, culling).
  • GPU: time the graphics card needs (resolution, shadows, lights, shader complexity, post process).

The frame takes roughly the maximum of those, because the threads overlap. The largest one is your bottleneck; optimizing anything else does nothing until it falls below it.

Python Stand-in: which thread is the bottleneck?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Matching tactics to the bottleneck:

  • Game thread bound: reduce Tick count, turn off ticking on idle Actors, replace per-frame polling with events, move heavy work to async tasks or use Mass/ISM for many objects, and cut Blueprint cost with Nativization alternatives (move hot Blueprint code into C++).
  • Render thread bound: reduce draw calls with instancing (Instanced Static Mesh, HISM), merge actors, use fewer materials per mesh, enable Nanite for supported meshes, and use occlusion and distance culling.
  • GPU bound: lower resolution scale, reduce shadow-casting lights, simplify expensive materials (check Shader Complexity), lower Lumen quality or use virtual shadow map limits, reduce translucent overdraw.

View modes for diagnosis

In the viewport, Lit menu > Optimization Viewmodes:

  • Shader Complexity: green is cheap, red and white are expensive. Hot spots usually mean overdraw by translucent materials.
  • Light Complexity: shows how many lights touch each pixel.
  • Quad Overdraw and Nanite Visualization modes help for geometry.
  • Lightmap Density is for baked workflows.

Unreal Insights

Unreal Insights is the full timeline profiler. Start the editor or game with -trace=cpu,gpu,frame,log,bookmark (for example UnrealEditor.exe MyGame.uproject -trace=cpu,frame), or use the Trace menu in the editor status bar. Then open Unreal Insights from the engine's Binaries folder (or Tools > Unreal Insights), pick the session and open the Timing Insights view. You can see each thread's work as horizontal bars, zoom into a slow frame, and find the exact function responsible. For shipping-style problems use the Test build configuration, which keeps profiling hooks. It is the next step after stat unit points you to a thread.

You can add your own timing scopes in C++:

C++
#include "ProfilingDebugging/CpuProfilerTrace.h"

void AEnemyManager::UpdateAll()
{
    TRACE_CPUPROFILER_EVENT_SCOPE(EnemyManager_UpdateAll);
    // ... work ...
}

Statistics on samples

One slow frame is not a pattern. Use averages and high percentiles: a game averaging 16 ms with occasional 80 ms spikes feels bad, so look at the worst 1 percent of frames.

Python Stand-in: average vs spikes

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The average (about 23 ms) hides two huge hitches of 80 ms or more, which the player will feel as stutter. Always check the graph, not just the average.

A measuring workflow

  1. Reproduce the problem in a Development or Test build, not just in the editor (the editor adds overhead).
  2. Run stat unit and find the biggest number.
  3. Use the matching tool: stat game / Insights, stat scenerendering, or stat gpu.
  4. Change one thing.
  5. Measure again, and keep notes.

For concrete fixes, continue with Optimization: LODs, Nanite and streaming.

Common mistakes

  • Profiling in the editor viewport with all panels open. Use Standalone Game or a packaged build.
  • Optimizing the wrong thread. Always check stat unit first.
  • Trusting averages. Hitches decide how a game feels.
  • Changing many things at once. You will not know what helped.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which command shows Game, Draw and GPU times in milliseconds?

    stat unit lists the frame, game thread, render thread and GPU times.
  2. 2. A scene has Game 6 ms, Draw 8 ms, GPU 27 ms. What should you optimize first?

    The frame is limited by the largest number, the GPU at 27 ms.
  3. 3. What is the frame budget at 60 fps?

    1000 ms divided by 60 is about 16.7 ms.
  4. 4. Which tool gives a detailed per-thread timeline of a recorded session?

    Unreal Insights records trace data and shows timing for every thread.

Summary

  • Think in milliseconds against a frame budget (16.7 ms for 60 fps).
  • stat unit tells you whether the Game thread, Render thread or GPU is the bottleneck.
  • Use stat gpu, view modes and Unreal Insights to dig into the worst thread.
  • Measure in a Development or Test build, change one thing at a time and watch spikes, not only averages.

Next: Optimization: LODs, Nanite and Streaming