unreal.tsx 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. import {Fragment} from 'react';
  2. import styled from '@emotion/styled';
  3. import {Alert} from 'sentry/components/alert';
  4. import ExternalLink from 'sentry/components/links/externalLink';
  5. import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
  6. import {
  7. Docs,
  8. DocsParams,
  9. OnboardingConfig,
  10. } from 'sentry/components/onboarding/gettingStartedDoc/types';
  11. import {t, tct} from 'sentry/locale';
  12. type Params = DocsParams;
  13. const getVerifySnippet = () => `
  14. #include "SentrySubsystem.h"
  15. void Verify()
  16. {
  17. // Obtain reference to GameInstance
  18. UGameInstance* GameInstance = ...;
  19. // Capture message
  20. USentrySubsystem* SentrySubsystem = GameInstance->GetSubsystem<USentrySubsystem>();
  21. SentrySubsystem->CaptureMessage(TEXT("Capture message"));
  22. }`;
  23. const getCrashReporterConfigSnippet = (params: Params) => `
  24. [CrashReportClient]
  25. CrashReportClientVersion=1.0
  26. DataRouterUrl="${params.dsn}"`;
  27. const onboarding: OnboardingConfig = {
  28. install: () => [
  29. {
  30. type: StepType.INSTALL,
  31. description: (
  32. <Fragment>
  33. <p>
  34. {tct(
  35. "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.",
  36. {
  37. link: (
  38. <ExternalLink href="https://github.com/getsentry/sentry-unreal/releases" />
  39. ),
  40. }
  41. )}
  42. </p>
  43. <p>
  44. {tct(
  45. '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.',
  46. {
  47. strong: <strong />,
  48. }
  49. )}
  50. </p>
  51. </Fragment>
  52. ),
  53. configurations: [
  54. {
  55. language: 'csharp',
  56. description: t(
  57. "To access the plugin API from within C++, add Sentry support to the build script (MyProject.build.cs):'"
  58. ),
  59. code: 'PublicDependencyModuleNames.AddRange(new string[] { ..., "Sentry" });',
  60. },
  61. ],
  62. },
  63. ],
  64. configure: params => [
  65. {
  66. type: StepType.CONFIGURE,
  67. description: tct(
  68. "Access the Sentry configuration window by going to editor's menu: [strong:Project Settings > Plugins > Sentry] and enter the following DSN:",
  69. {strong: <strong />}
  70. ),
  71. configurations: [
  72. {
  73. language: 'url',
  74. code: params.dsn,
  75. },
  76. ],
  77. },
  78. ],
  79. verify: params => [
  80. {
  81. type: StepType.VERIFY,
  82. description: t(
  83. 'Once everything is configured you can call the plugin API from both C++ and blueprints:'
  84. ),
  85. configurations: [
  86. {
  87. language: 'cpp',
  88. code: getVerifySnippet(),
  89. },
  90. ],
  91. },
  92. {
  93. title: t('Crash Reporter Client'),
  94. description: tct(
  95. 'For Windows and Mac, [link:Crash Reporter Client] provided along with Unreal Engine has to be configured in order to capture errors automatically.',
  96. {
  97. link: (
  98. <ExternalLink href="https://docs.sentry.io/platforms/unreal/setup-crashreporter/" />
  99. ),
  100. }
  101. ),
  102. configurations: [
  103. {
  104. description: (
  105. <Fragment>
  106. <h5>{t('Include the UE Crash Reporter')}</h5>
  107. <p>
  108. {tct(
  109. 'You can add the crash reporter client to your game in [strong:Project Settings].',
  110. {strong: <strong />}
  111. )}
  112. </p>
  113. <p>
  114. {tct(
  115. 'The option is located under [strong:Project > Packaging]; select "show advanced" followed by checking the box for "Include Crash Reporter".',
  116. {strong: <strong />}
  117. )}
  118. </p>
  119. </Fragment>
  120. ),
  121. },
  122. {
  123. description: (
  124. <Fragment>
  125. <h5>{t('Debug Information')}</h5>
  126. {t(
  127. '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.'
  128. )}
  129. <p>
  130. {tct(
  131. "The option is also located under [strong:Project > Packaging]; select 'show advanced' followed by checking the box for 'Include Debug Files'.",
  132. {strong: <strong />}
  133. )}
  134. </p>
  135. </Fragment>
  136. ),
  137. },
  138. {
  139. description: (
  140. <Fragment>
  141. <h5>{t('Configure the Crash Reporter Endpoint')}</h5>
  142. <p>
  143. {tct(
  144. "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:",
  145. {
  146. code: <code />,
  147. italic: <i />,
  148. }
  149. )}
  150. </p>
  151. <AlertWithoutMarginBottom type="info">
  152. engine-dir\Engine\Programs\CrashReportClient\Config\DefaultEngine.ini
  153. </AlertWithoutMarginBottom>
  154. </Fragment>
  155. ),
  156. configurations: [
  157. {
  158. description: t('Add the configuration section:'),
  159. language: 'ini',
  160. code: getCrashReporterConfigSnippet(params),
  161. additionalInfo: (
  162. <p>
  163. {tct(
  164. 'If a [crashReportCode:CrashReportClient] section already exists, simply changing the value of [dataRouterUrlCode:DataRouterUrl] is enough.',
  165. {crashReportCode: <code />, dataRouterUrlCode: <code />}
  166. )}
  167. </p>
  168. ),
  169. },
  170. ],
  171. },
  172. ],
  173. },
  174. {
  175. title: t('Upload Debug Symbols'),
  176. description: (
  177. <Fragment>
  178. <p>
  179. {tct(
  180. 'To allow Sentry to fully process native crashes and provide you with symbolicated stack traces, you need to upload [debugInformationItalic:debug information files] (sometimes also referred to as [debugSymbolsItalic:debug symbols] or just [symbolsItalic:symbols]). We recommend uploading debug information during your build or release process.',
  181. {
  182. debugInformationItalic: <i />,
  183. symbolsItalic: <i />,
  184. debugSymbolsItalic: <i />,
  185. }
  186. )}
  187. </p>
  188. <p>
  189. {tct(
  190. "For all libraries where you'd like to receive symbolication, [strong:you need to provide debug information]. This includes dependencies and operating system libraries.",
  191. {
  192. strong: <strong />,
  193. }
  194. )}
  195. </p>
  196. <p>
  197. {tct(
  198. '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',
  199. {italic: <i />}
  200. )}
  201. </p>
  202. <p>
  203. {tct(
  204. 'For more information on uploading debug information and their supported formats, check out our [link:Debug Information Files documentation].',
  205. {
  206. link: (
  207. <ExternalLink href="https://docs.sentry.io/platforms/native/data-management/debug-files/" />
  208. ),
  209. }
  210. )}
  211. </p>
  212. </Fragment>
  213. ),
  214. },
  215. ],
  216. };
  217. const docs: Docs = {
  218. onboarding,
  219. };
  220. export default docs;
  221. const AlertWithoutMarginBottom = styled(Alert)`
  222. margin-bottom: 0;
  223. `;