Sentry Unreal Engine SDK Sample Project

July 7, 2026 ยท View on GitHub


Sentry Unreal Engine SDK Sample Project

This sample project demonstrates the capabilities of the Sentry Unreal Engine SDK and provides a comprehensive testing environment for all SDK features.

Getting started

Prerequisites

  • Unreal Engine 4.27 or newer (version configured in SentryPlayground.uproject)
  • Platform support: Windows, macOS, Linux, Android, iOS, PlayStation 5, Xbox, Nintendo Switch
  • Sentry account with a project and DSN

Setup

  • Clone or download the Sentry Unreal SDK repository
  • Provide the Sentry plugin under sample/Plugins/Sentry/ โ€” either extract a pre-made package from the Releases page, or build locally from plugin-dev/ sources (see CONTRIBUTING.md)
  • Open SentryPlayground.uproject in Unreal Engine
  • Configure your Sentry DSN in Config/DefaultEngine.ini or through the project settings menu
  • Play the SentryDemo level to begin testing

Project structure overview

Here's a breakdown of the important sample project files and folders:

๐Ÿ“ sample
โ”œโ”€โ”€ ๐Ÿ“„ SentryPlayground.uproject                    # Engine version configuration, supports UE 4.27 and newer
โ”œโ”€โ”€ ๐Ÿ“ Source/
โ”‚   โ””โ”€โ”€ ๐Ÿ“ SentryPlayground/
โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ SentryPlaygroundGameInstance.cpp/.h       # Dispatches integration tests based on command-line switches
โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ SentryPlaygroundGameModeBase.cpp/.h       # Sample game mode
โ”‚       โ”œโ”€โ”€ ๐Ÿ“ IntegrationTests/                         # One class per integration test, sharing a common base
โ”‚       โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ SentryBaseIntegrationTest.cpp/.h      # Base class (FSentryBaseIntegrationTest) with shared helpers
โ”‚       โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ SentryCrashTest.cpp/.h                # Crash scenarios (null ptr, stack overflow, OOM, etc.)
โ”‚       โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ SentryMessageTest.cpp/.h              # Message capture with scope customization
โ”‚       โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ SentryLogTest.cpp/.h                  # Structured log capture
โ”‚       โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ SentryMetricTest.cpp/.h               # Counter/distribution/gauge metrics
โ”‚       โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ SentryReplayTest.cpp/.h               # Session Replay envelope capture
โ”‚       โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ SentryTracingTest.cpp/.h              # Transactions and spans
โ”‚       โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ SentryEnsureTest.cpp/.h               # Non-fatal ensure() capture
โ”‚       โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ SentryHangTest.cpp/.h                 # Application hang detection
โ”‚       โ”‚   โ””โ”€โ”€ ๐Ÿ“„ SentryInitOnlyTest.cpp/.h             # SDK init smoke test
โ”‚       โ”œโ”€โ”€ ๐Ÿ“ Hooks/                                    # Example C++ implementations of SDK hook handlers
โ”‚       โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ CppBeforeSendHandler.cpp/.h
โ”‚       โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ CppBeforeBreadcrumbHandler.cpp/.h
โ”‚       โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ CppBeforeLogHandler.cpp/.h
โ”‚       โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ CppBeforeMetricHandler.cpp/.h
โ”‚       โ”‚   โ””โ”€โ”€ ๐Ÿ“„ CppTraceSampler.cpp/.h
โ”‚       โ””โ”€โ”€ ๐Ÿ“ Utils/
โ”‚           โ”œโ”€โ”€ ๐Ÿ“„ SentryPlaygroundCrashUtils.cpp/.h     # Crash/ensure/hang trigger helpers + ESentryAppTerminationType enum
โ”‚           โ”œโ”€โ”€ ๐Ÿ“„ SentryPlaygroundBlueprintUtils.cpp/.h # Misc Blueprint-callable helpers (string/bytes/file)
โ”‚           โ””โ”€โ”€ ๐Ÿ“„ SentryGCCallback.cpp/.h               # Utility for capturing events during garbage collection
โ”œโ”€โ”€ ๐Ÿ“ Content/
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ Maps/
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ“„ SentryDemo.umap                      # Main demo level
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ UI/
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ“„ W_SentryDemo.uasset                  # Demo UI widget for testing SDK features
โ”‚   โ””โ”€โ”€ ๐Ÿ“ Misc/
โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ BP_BeforeSendHandler.uasset          # Example Blueprint implementation of `beforeSend` hook handler
โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ BP_BeforeBreadcrumbHandler.uasset    # Example Blueprint implementation of `beforeBreadcrumb` hook handler
โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ BP_BeforeLogHandler.uasset           # Example Blueprint implementation of `beforeLog` hook handler
โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ BP_BeforeMetricHandler.uasset        # Example Blueprint implementation of `beforeMetric` hook handler
โ”‚       โ””โ”€โ”€ ๐Ÿ“„ BP_TraceSampler.uasset               # Example Blueprint implementation of `tracesSampler` hook handler
โ”œโ”€โ”€ ๐Ÿ“ Config/
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ DefaultEngine.ini                        # Sentry plugin settings live here under `[/Script/Sentry.SentrySettings]`
โ””โ”€โ”€ ๐Ÿ“ Plugins/                                     # Location for Sentry SDK sources - copy or symlink here

Demo Level

The demo level (SentryDemo.umap) in the project's Content folder presents a simple UI for sending test events to Sentry. The W_SentryDemo Blueprint implementation demonstrates how to call the plugin API and serves as a reference.

To run the demo level, navigate to Content Browser -> Content -> Maps and open the SentryDemo map. Click Play to launch the demo.

Unit Tests

To run automation tests, several engine plugins are enabled (see Settings -> Plugins -> Testing). Navigate to Windows -> Test Automation menu and open the Session Frontend window. Switch to the Automation tab and select Sentry from the list of available tests. Click the Start Tests button to run the tests and check the results.

Integration Tests

The SentryPlaygroundGameInstance.cpp file contains logic that parses command line input used to launch the sample game build and runs test actions accordingly. Here are example commands:

# Windows - Crash capture test
SentryPlayground.exe -nullrhi -unattended -log -crash-capture

# Windows - Message capture test
SentryPlayground.exe -nullrhi -unattended -log -message-capture

The following test switches are supported:

  • -crash-capture - generic nullptr-dereferencing crash
  • -crash-stack-overflow - stack overflow crash
  • -crash-memory-corruption - memory corruption crash
  • -crash-assert - check() assertion failure
  • -crash-oom - out-of-memory crash
  • -message-capture - capture a message event
  • -log-capture - capture a structured log
  • -metric-capture - emit a metric
  • -tracing-capture - capture a transaction/span
  • -ensure-capture - trigger a non-fatal ensure()
  • -hang-capture - simulate an application hang
  • -replay-capture - capture session replay clip
  • -init-only - initialize the SDK and exit without running a test action

The game will close after the test is completed. Otherwise, the game will launch as usual and present the sample UI.

After completing a test the game emits a single line to stdout in the form TEST_RESULT: {"test":"<name>","success":<true|false>,"message":"<text>"}, which the CI test harness parses to determine the outcome.

Optionally, you can override Sentry plugin settings specified in the configuration .ini file by passing additional input arguments in the following format:

# -ini:Engine:[/Script/Sentry.SentrySettings]:<SettingName>=<Value>`

SentryPlayground.exe -nullrhi -unattended -log -crash-capture -ini:Engine:[/Script/Sentry.SentrySettings]:Dsn="your-dsn-here"

Example Content

The sample project contains example Blueprint implementations of various hook handlers under Content -> Misc:

  • BP_BeforeSendHandler - Filter or modify events before they are sent
  • BP_BeforeBreadcrumbHandler - Filter or modify breadcrumbs before they are recorded
  • BP_BeforeLogHandler - Filter or modify structured logs before they are sent
  • BP_BeforeMetricHandler - Filter or modify metrics before they are emitted
  • BP_TraceSampler - Decide the sample rate for transactions

These can be configured for the SDK to use in Project Settings -> Plugins -> Sentry -> Hooks.