import {Fragment} from 'react'; import styled from '@emotion/styled'; import {Alert} from 'sentry/components/alert'; import ExternalLink from 'sentry/components/links/externalLink'; import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step'; import type { Docs, DocsParams, OnboardingConfig, } from 'sentry/components/onboarding/gettingStartedDoc/types'; import { getCrashReportApiIntroduction, getCrashReportInstallDescription, } from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding'; import {t, tct} from 'sentry/locale'; type Params = DocsParams; const getVerifySnippet = () => ` #include "SentrySubsystem.h" void Verify() { // Obtain reference to GameInstance UGameInstance* GameInstance = ...; // Capture message USentrySubsystem* SentrySubsystem = GameInstance->GetSubsystem(); SentrySubsystem->CaptureMessage(TEXT("Capture message")); }`; const getCrashReporterConfigSnippet = (params: Params) => ` [CrashReportClient] CrashReportClientVersion=1.0 DataRouterUrl="${params.dsn.unreal}"`; const onboarding: OnboardingConfig = { install: () => [ { type: StepType.INSTALL, description: (

{tct( "Download the latest plugin sources from the [link:Releases] page and place it in the project's 'Plugins' directory. On the next project launch, UE will prompt to build Sentry module.", { link: ( ), } )}

{tct( 'After the successful build, in the editor navigate to the [strong:Project Settings > Plugins > Code Plugins] menu and check whether the Sentry plugin is enabled.', { strong: , } )}

), configurations: [ { language: 'csharp', description: t( "To access the plugin API from within C++, add Sentry support to the build script (MyProject.build.cs):'" ), code: 'PublicDependencyModuleNames.AddRange(new string[] { ..., "Sentry" });', }, ], }, ], configure: params => [ { type: StepType.CONFIGURE, description: tct( "Access the Sentry configuration window by going to editor's menu: [strong:Project Settings > Plugins > Sentry] and enter the following DSN:", {strong: } ), configurations: [ { language: 'url', code: params.dsn.public, }, ], }, ], verify: params => [ { type: StepType.VERIFY, description: t( 'Once everything is configured you can call the plugin API from both C++ and blueprints:' ), configurations: [ { language: 'cpp', code: getVerifySnippet(), }, ], }, { title: t('Crash Reporter Client'), description: tct( 'For Windows and Mac, [link:Crash Reporter Client] provided along with Unreal Engine has to be configured in order to capture errors automatically.', { link: ( ), } ), configurations: [ { description: (
{t('Include the UE Crash Reporter')}

{tct( 'You can add the crash reporter client to your game in [strong:Project Settings].', {strong: } )}

{tct( 'The option is located under [strong:Project > Packaging]; select "show advanced" followed by checking the box for "Include Crash Reporter".', {strong: } )}

), }, { description: (
{t('Debug Information')}
{t( 'To get the most out of Sentry, crash reports must include debug information. In order for Sentry to be able to process the crash report and translate memory addresses to meaningful information like function names, module names, and line numbers, the crash itself must include debug information. In addition, symbols need to be uploaded to Sentry.' )}

{tct( "The option is also located under [strong:Project > Packaging]; select 'show advanced' followed by checking the box for 'Include Debug Files'.", {strong: } )}

), }, { description: (
{t('Configure the Crash Reporter Endpoint')}

{tct( "Now that the crash reporter and debug files are included, UE needs to know where to send the crash. For that, add the Sentry 'Unreal Engine Endpoint' from the 'Client Keys' settings page to the game's configuration file. This will include which project in Sentry you want to see crashes displayed in. That's accomplished by configuring the [code:CrashReportClient] in the [italic:DefaultEngine.ini] file. Changing the engine is necessary for this to work. Edit the file:", { code: , italic: , } )}

engine-dir\Engine\Programs\CrashReportClient\Config\DefaultEngine.ini
), configurations: [ { description: t('Add the configuration section:'), language: 'ini', code: getCrashReporterConfigSnippet(params), additionalInfo: (

{tct( 'If a [code:CrashReportClient] section already exists, simply changing the value of [code:DataRouterUrl] is enough.', {code: } )}

), }, ], }, ], }, { title: t('Upload Debug Symbols'), description: (

{tct( 'To allow Sentry to fully process native crashes and provide you with symbolicated stack traces, you need to upload [italic:debug information files] (sometimes also referred to as [italic:debug symbols] or just [italic:symbols]). We recommend uploading debug information during your build or release process.', { italic: , } )}

{tct( "For all libraries where you'd like to receive symbolication, [strong:you need to provide debug information]. This includes dependencies and operating system libraries.", { strong: , } )}

{tct( 'In addition to debug information files, Sentry needs [italic:call frame information] (CFI) to extract accurate stack traces from minidumps of optimized release builds. CFI is usually part of the executables and not copied to debug symbols. Unless you are uploading Breakpad symbols, be sure to also include the binaries when uploading files to Sentry', {italic: } )}

{tct( 'For more information on uploading debug information and their supported formats, check out our [link:Debug Information Files documentation].', { link: ( ), } )}

), }, ], }; const feedbackOnboardingCrashApi: OnboardingConfig = { introduction: () => getCrashReportApiIntroduction(), install: () => [ { type: StepType.INSTALL, description: getCrashReportInstallDescription(), configurations: [ { code: [ { label: 'C++', value: 'cpp', language: 'cpp', code: `USentrySubsystem* SentrySubsystem = GEngine->GetEngineSubsystem(); USentryId* EventId = SentrySubsystem->CaptureMessage(TEXT("Message with feedback")); USentryUserFeedback* UserFeedback = NewObject(); User->Initialize(EventId); User->SetEmail("test@sentry.io"); User->SetName("Name"); User->SetComment("Some comment"); SentrySubsystem->CaptureUserFeedback(UserFeedback); // OR SentrySubsystem->CaptureUserFeedbackWithParams(EventId, "test@sentry.io", "Some comment", "Name");`, }, ], }, ], }, ], configure: () => [], verify: () => [], nextSteps: () => [], }; const docs: Docs = { onboarding, feedbackOnboardingCrashApi, crashReportOnboarding: feedbackOnboardingCrashApi, }; export default docs; const AlertWithoutMarginBottom = styled(Alert)` margin-bottom: 0; `;