Home › Utilities › AFU_Debug
Utility

AFU_Debug

Runtime debug overlay showing FPS, frame time, draw calls, triangles, object and widget counts, backed by a C++ stats library.

What it gives you

  • Live performance readout in VR and on desktop
  • Scene and object statistics
  • A debug page for the menu

Requires

AFA_Colors AFS_UI AFS_UI_InfoPanels

Required by

AF_Examples

8 assets21 API members

Description

Performance problems in VR are hard to diagnose from outside the headset. AFU_Debug puts the numbers in front of the player: frame rate, frame time, draw calls, triangle count, primitive and component counts, total UObjects, and total and visible widget counts.

UAFUDebugStatsLibrary provides the values in C++; the widgets present them through the info panel system, and DA_WidgetPage_Debug drops the whole thing into the menu as a page.

Setup

  1. Add DA_WidgetPage_Debug to your pawn's BPC_Pawn_Menu Pages list.

Usage

Reading the overlay

Widget count is the one most often overlooked — a high visible widget count is a common cause of poor VR frame times.

Using the stats in your own UI

Call the UAFUDebugStatsLibrary functions directly; they are Blueprint-pure and available anywhere.

The debug overlay in play
AFU_Debug_result.pngThe debug overlay in play
The debug overlay in play

Key properties

PropertyWhen to change
Which panels are shownAdd or remove the info panel widgets from the debug page

Extending

Add your own info panel widgets deriving from WBP_Base and register them alongside the shipped ones.

Performance notes

Performance

The overlay itself costs draw calls and widget updates. Remove the debug page from shipping builds rather than only hiding it.

Example map

Available as a menu page in Map_Examples_Lobby.

Troubleshooting

Stats read zero. The stats library needs a world context; ensure the calling widget has a valid owning player.

API reference

Every blueprint asset in this module. Expand an asset to see its members.

Libraries

BFL_Debug1 members
extends BlueprintFunctionLibrary

Function library holding one static call, Get Platform Type, which folds the running platform and whether a headset is enabled into a single name: PC, PC VR, Mobile, Mobile VR, Console or Console VR. Call it when behaviour should branch by device rather than by pawn.

KindNameSignatureDescription
fngetPlatformType(__WorldContext: Object, out PlatformType: name)Returns the platform the build is running on as one of PC, PC_VR, Mobile, Mobile_VR, Console or Console_VR. Windows, Mac and Linux fold into PC, Android and iOS into Mobile, and PlayStation, Xbox and Switch into Console, with the VR variant chosen whenever a head mounted display is enabled. An unrecognised platform comes back as None.

Widgets

WBP_Debug0 members
extends WBP_Base

Root widget of the debug menu, pairing a horizontal pagination bar with a switcher over the scene and level pages. Show it through the pawn UI or HUD when you want the debug tools in a build; nothing in the framework opens it for you.

No editor-visible members; this asset configures defaults only.

WBP_Debug_Levels3 members
extends WBP_Base

Level page of the debug menu. Walks every actor in the world to collect the streaming levels in play, lists them as checkbox buttons and loads or unloads a level when its button is clicked, flushing streaming so the change is immediate. Part of the debug menu rather than a widget to use alone.

KindNameSignatureDescription
fnUpdateLoadedLevels()Refreshes the level list so a checkbox is ticked for each streaming level that is currently visible. Runs at the end of Get All Levels and after every toggle, and is worth calling again whenever levels are streamed in or out behind the menu's back.
fnGetAllLevels()Walks every actor in the world, collects the name of each streaming level they live in, and adds one checkbox to the level list per name before refreshing which of them are ticked. Call it once as the page opens; calling it again appends a second checkbox for every level already listed.
eventWidgetElement_PostInitiateStyle()Called by the widget system once the whole tree has been initiated and themed. Left empty here, so the level list stays empty until something calls Get All Levels.
WBP_Debug_Scene4 members
extends WBP_Base

Scene page of the debug menu. Holds the view mode drop-down, which runs the matching viewmode console command, and the toggles for the frame rate, object and scene info panels and for skeletal mesh and particle rendering. Part of the debug menu rather than a widget to use alone.

KindNameSignatureDescription
eventWidgetElement_PostInitiateStyle()Called by the widget system once the whole tree has been initiated and themed. Left empty, so the three panel toggles open in the state the designer left them in; call Update FPS State, Update Objects and Update Scene if they should match the panels already on screen.
eventUpdateFPSState()Sets the Show FPS toggle to match whether the frame rate info panel is currently on the player pawn's display. Call it whenever that panel is opened or closed from somewhere other than this page.
eventUpdateObjects()Sets the Object Counter toggle to match whether the object count info panel is currently on the player pawn's display. Nothing on this page calls it, so call it yourself after that panel is opened or closed.
eventUpdateScene()Sets the Scene Counter toggle to match whether the scene statistics info panel is currently on the player pawn's display. Nothing on this page calls it, so call it yourself after that panel is opened or closed.

Widgets/Helper

WBP_Stat_Row7 members
extends WBP_Base

One row of a debug info panel: a title, a caption carrying the maximum, and a value that shifts from green to red as it approaches that maximum, or the other way round when inverted. Reused by the frame rate, object and scene panels; the format text decides the unit shown after the number.

KindNameSignatureDescription
varMain TextDescriptiontextLabel naming what the row measures, such as FPS, Objects or Draw Calls. Set it on the row instance in the designer; nothing in the graph rewrites it while the game runs.
varMax ValueStateintFigure treated as the top of the range when the readout is coloured, and the number shown in the caption under the label. Set Max Value writes both at once; left at zero the colour ramp has no range to work against and the readout sits at one end of it.
varFormatDescriptiontextText the current figure is substituted into before it is shown, {Value} by default. Put {Value} where the number belongs and add the unit around it, as in {Value}ms or {Value}/s.
varPercentageDescriptionfloatFraction of Max Value over which the readout changes colour, 0.2 by default. At 0.2 the figure stays green until it passes eighty per cent of Max Value and is fully red by the time it reaches it; raise it to start the shift earlier.
varBackgroundDescriptionST_Color_DefinitionTheme colour the row sits on, Background High by default. Update Value checks the green and red against it and flips their brightness when they would not stand out, so the readout stays legible in light and dark themes. Change it when the row is placed on a different background.
eventUpdateValue(CurrentValue: int)Writes a new figure into the row through the Format text and recolours it by how close it sits to Max Value, running from green up to red across the top slice of the range set by Percentage. Invert swaps the two ends for figures where high is good.
eventSetMaxValue(MaxValue: int)Stores a new ceiling for the row and writes it into the caption under the label. Call it before the first Update Value, since a row left at zero has no range to colour against.

Widgets/InfoPanels

WBP_InfoPanel_FPS2 members
extends WBP_Base

Debug overlay showing frames per second and frame time in milliseconds, both coloured against their limits. Refreshed by calling Update FPS, and toggled from the scene page of the debug menu rather than opened directly.

KindNameSignatureDescription
eventUpdateFPS()Pushes the current frame rate and frame time in milliseconds, both rounded to whole numbers, into the two rows of the panel. Nothing drives it on its own, so call it from a timer or a tick if the readout should keep moving.
eventWidgetElement_PostInitiateStyle()Called by the widget system once the whole tree has been initiated and themed. Left empty, so both rows stay blank and keep a Max Value of zero until something calls Update FPS and Set Max Value on them.
WBP_InfoPanel_Objects2 members
extends WBP_Base

Debug overlay counting the live objects, components and widgets in the running game, useful for tracking down leaks and pooling that never returns anything. Refreshed by calling Update Count, and toggled from the scene page of the debug menu.

KindNameSignatureDescription
eventUpdateCount()Pushes the total object count, component count and widget count of the running game into the three rows of the panel. Nothing drives it on its own, so call it from a timer or a tick to keep the counts current.
eventWidgetElement_PostInitiateStyle()Called by the widget system once the whole tree has been initiated and themed. Left empty, so the three rows stay blank and keep a Max Value of zero until something calls Update Count and Set Max Value on them.
WBP_InfoPanel_Scene2 members
extends WBP_Base

Debug overlay showing the triangle count and draw calls of the current frame, the two numbers that matter most on standalone headsets. Refreshed by calling Update Count, and toggled from the scene page of the debug menu.

KindNameSignatureDescription
eventUpdateCount()Pushes the triangle count and the number of draw calls of the last frame into the two rows of the panel. Nothing drives it on its own, so call it from a timer or a tick to keep the readout current.
eventWidgetElement_PostInitiateStyle()Called by the widget system once the whole tree has been initiated and themed. Left empty, so both rows stay blank and keep a Max Value of zero until something calls Update Count and Set Max Value on them.