unreal.tsx 8.1 KB

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