Aperture UI
Content development

Debugging

Connecting Chrome DevTools, logging, AperturePlayer iteration, and diagnosing common UI problems in Aperture UI.

Aperture UI implements the Chrome DevTools Protocol (CDP). When the developer engine module is loaded and its server is running, you can attach Chrome's DevTools to your running game.

Included in the Windows SDK

The 26.08.0.1 Windows SDK includes a working CDP server in apertureuideveloperengine.dll, its network dependencies, and the Chrome DevTools frontend. Your host starts the server, selects a view, and calls DevToolsHost::Tick() on the main thread. Including the DLL does not open a port automatically. Custom PartialCore source builds can still select the stub network configuration; use NS_APUI_BUILD_UNREAL_SDK=ON for the network-enabled SDK configuration.

Starting the DevTools Server

A host starts the server with aperture::developer::DevToolsHost, points it at a view, and calls its Tick() every frame. Strip it from shipping retail builds. The facade, its configuration, the authentication token and the commands the server accepts are on the DevTools page.

Connecting Chrome DevTools

  1. Run your game with the developer engine started
  2. Open Chrome and navigate to chrome://inspect
  3. Under Devices, configure localhost:9222 if it is not already listed
  4. Click Inspect on the Aperture UI target

Or open http://localhost:9222/ directly, which serves the DevTools front end the package carries. http://localhost:9222/json/list returns the target list as JSON.

Keep the debugger bound to loopback during local development.

What You Can Do in DevTools

PanelWhat it does
ElementsInspect the DOM, edit attributes and an element's HTML, see computed CSS and the box model, and edit an element's inline style or replace a stylesheet's text. Forcing :hover or :focus, adding a rule and click-to-inspect do nothing.
ConsoleRun JavaScript in the UI context, see console.log, warn and error output, evaluate expressions
SourcesBrowse loaded scripts, set breakpoints, step through JavaScript, pause on exceptions. V8's own inspector backs these, so they behave as they do in Chrome.
NetworkRequests for scripts, stylesheets, images and SVG that the engine makes through your network provider. Files read through your file system, and fetch() and XMLHttpRequest requests, are not listed.
PerformanceA timeline of Layout, RecalcStyles, Paint, script and event work
AnimationsLists CSS animations as they start. The pause, speed and scrub controls do nothing in the provider DevToolsHost uses.
MemoryCPU and heap profiles from V8's profilers

The Performance panel is the first place to look when a screen is slow: it shows where the style, layout, paint and script time went. The DevTools page lists every area and the commands that are accepted and ignored.

JavaScript Console Logging

console is supported as in any browser:

console.log('Player health:', player.health);
console.warn('Slow screen transition');
console.error('Failed to load HUD config', error);
console.group('Frame stats');
console.log('JS:', jsTime);
console.log('Layout:', layoutTime);
console.groupEnd();

console.log output appears in the DevTools console and reaches your IAPCLoggingSystem through DOMConsoleHook. See Scripting.

C++-Side Logging

Install IAPCLoggingSystem before SDK initialization. Use the complete setup in Your own C++ host, including the self-contained headers and the logging object lifetime. JavaScript diagnostics and engine errors use this interface. Messages about CSS the engine skipped reach the same log once you call SetInternalEngineLogging(true). Keep development debugging out of shipping builds.

AperturePlayer for Rapid Iteration

For UI-only iteration, AperturePlayer is faster than rebuilding the game:

APPlayer.exe --html=ui/main-menu/index.html --watch

AperturePlayer is a host application in the engine source tree, in Code/Applications/APPlayer/. It is not part of the generic SDK download. See Samples and preview tools.

--html/--html= (or --url/--url=) sets the document to load. A bare path or an http:// or https:// address is accepted as the document too, so you can point it at a dev server. --watch is a bare flag: it reloads when a file under the document's folder changes, and it is implemented for Windows. Designers and frontend developers can edit HTML, CSS and JS in any editor and see results immediately. AperturePlayer uses the same APHTML and APHarrlow stack as the engine, so what you see is close to what you will get, but check your own renderer too.

Common Debug Scenarios

SymptomWhere to look
Element not visibleElements panel in a full build, or a browser: check display, visibility, opacity, z-index and container overflow
Wrong layoutInspect the box model and the parent's flex or grid settings
JavaScript event not firingSources panel: set a breakpoint in the handler. Without DevTools, log from the handler.
font-family falls backThe engine log reports a missing font file. document.fonts is a stub and always reports success, so do not rely on check(). See Fonts.
Animation does not playCheck that animation-name matches an @keyframes rule, and that the host is calling tick(). See Animations.
CSS rule not appliedComputed style in the Elements panel. The engine log warns about properties it skips. See HTML and CSS Guide.
Image fails to loadThe engine log, then the format: PNG, JPEG, BMP and GIF decode, WebP and AVIF do not. Check that the URL resolves through your IAPCFileSystem.
Frame budget exceededThe Performance panel in a full build. In any build, time tick() and buildCommandList() and use the environment probes. See Performance.

Without the DevTools Server

In the standard download you have other ways to see what a page is doing:

  • Page console calls reach your IAPCLoggingSystem.
  • Engine messages, including warnings about CSS the engine skipped, reach the same log once you call SetInternalEngineLogging(true). See Your own C++ host.
  • Environment probes that print timings to that log are in Performance.
  • Build the page in a browser first, and use the browser's DevTools there. See Getting started.

Some Chrome DevTools conveniences, such as toggling element states with the :hov button, click-to-inspect and the animation slow-motion toggle, are accepted by the server and do nothing against the engine. Use a browser for those while you author.

Logging from Inside an HTML Error Boundary

JavaScript exceptions surface in the DevTools console and through IAPCLoggingSystem. There is currently no window error or unhandledrejection DOM event dispatch to hook into for forwarding to your own telemetry. Uncaught exceptions and unhandled promise rejections are only surfaced through the log, not through those window events. window.addEventListener('error', ...) and window.addEventListener('unhandledrejection', ...) handlers will never fire. Use the IAPCLoggingSystem hook above to capture these instead.

On this page