Course contentsShow
← Unreal Engine Game Development
Lesson 570 of 8808. User Interface and MetaSoundsFree lesson

Profiling UI Performance with Slate Insights

Utilize the Unreal Insights tool to identify and resolve performance spikes caused by inefficient widget trees or excessive layout calculations.

In this lesson, you will learn how to leverage Unreal Insights to pinpoint performance spikes within your UI by analyzing Slate’s layout and paint phases.

When your game suffers from dropped frames, the culprit is often the UI, specifically the complex "Layout" and "Paint" passes that run every frame. Slate, the underlying framework for UMG, is incredibly powerful, but if you have deeply nested hierarchies or widgets that trigger invalidation constantly, you will create significant CPU overhead.

Utilizing the Slate Insights Module

To begin, launch your game with the command-line argument -trace=slate. This enables the specific instrumentation needed to track UI performance. Once you’ve captured a session, open Unreal Insights and navigate to the Timing Insights tab.

Look for the "Slate" timing tracks. You are specifically looking for two heavy hitters:

  • Slate Layout: This occurs when widgets calculate their size and position. If you see long bars here, your widget tree is likely too deep or you are calling ForceLayoutPrepass() too frequently.
  • Slate Paint: This is the phase where geometry is generated for the GPU. High times here often indicate an excessive number of widgets being redrawn unnecessarily.

Identifying Inefficient Widget Trees

A common performance killer is "Layout Thrashing," where a widget hierarchy is forced to recalculate its geometry because a parent or child is changing its size every frame. In Insights, look for repeating, high-frequency spikes in the SWidget::Tick or SWidget::Paint functions.

If you identify a specific widget causing a spike, check if you are using complex panels like SUniformGridPanel when a simpler SHorizontalBox would suffice, or if you are binding functions directly to properties that trigger a full UI refresh on every frame. Instead of high-frequency polling, utilize Invalidation Boxes to cache widget geometry:

// Wrap heavy widget trees in an Invalidation Box in UMG or 
// use SInvalidationPanel in Slate to stop layout recalculations.
MyInvalidationBox->SetInvalidationLayout(EInvalidationLayout::None);

By filtering your timing capture for Slate tracks, you can confirm whether your Invalidation Boxes are successfully preventing redundant calls, allowing you to optimize only the portions of the screen that truly need updating.

Key Takeaway: Use Unreal Insights with the -trace=slate flag to distinguish between costly Layout passes and Paint passes, then wrap dynamic content in Invalidation Boxes to minimize the UI’s CPU footprint.