unity.tsx 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. OnboardingConfig,
  9. } from 'sentry/components/onboarding/gettingStartedDoc/types';
  10. import {t, tct} from 'sentry/locale';
  11. import {getPackageVersion} from 'sentry/utils/gettingStartedDocs/getPackageVersion';
  12. const getVerifySnippet = () => `
  13. using Sentry; // On the top of the script
  14. SentrySdk.CaptureMessage("Test event");`;
  15. const onboarding: OnboardingConfig = {
  16. install: params => [
  17. {
  18. type: StepType.INSTALL,
  19. description: tct(
  20. "Install the package via the [link:Unity Package Manager] using a Git URL to Sentry's SDK repository:",
  21. {
  22. link: (
  23. <ExternalLink href="https://docs.unity3d.com/Manual/upm-ui-giturl.html" />
  24. ),
  25. }
  26. ),
  27. configurations: [
  28. {
  29. language: 'url',
  30. partialLoading: params.sourcePackageRegistries.isLoading,
  31. code: `https://github.com/getsentry/unity.git#${getPackageVersion(
  32. params,
  33. 'sentry.dotnet.unity',
  34. '1.5.0'
  35. )}`,
  36. },
  37. ],
  38. additionalInfo: (
  39. <AlertWithoutMarginBottom type="info">
  40. {tct(
  41. 'The Unity SDK now supports line numbers for IL2CPP. The feature is currently in beta, but you can enable it at [code:Tools -> Sentry -> Advanced -> IL2CPP] line numbers. To learn more check out our [link:docs].',
  42. {
  43. code: <code />,
  44. link: (
  45. <ExternalLink href="https://docs.sentry.io/platforms/unity/configuration/il2cpp/" />
  46. ),
  47. }
  48. )}
  49. </AlertWithoutMarginBottom>
  50. ),
  51. },
  52. ],
  53. configure: params => [
  54. {
  55. type: StepType.CONFIGURE,
  56. description: tct(
  57. "Access the Sentry configuration window by going to Unity's top menu: [toolsCode:Tools] > [sentryCode:Sentry] and enter the following DSN:",
  58. {toolsCode: <code />, sentryCode: <code />}
  59. ),
  60. configurations: [
  61. {
  62. language: 'url',
  63. code: params.dsn,
  64. },
  65. ],
  66. additionalInfo: (
  67. <Fragment>
  68. <p>{t("And that's it! Now Sentry can capture errors automatically.")}</p>
  69. {tct('If you like additional contexts you could enable [link:Screenshots].', {
  70. link: (
  71. <ExternalLink href="https://docs.sentry.io/platforms/unity/enriching-events/screenshots/" />
  72. ),
  73. })}
  74. </Fragment>
  75. ),
  76. },
  77. ],
  78. verify: () => [
  79. {
  80. type: StepType.VERIFY,
  81. description: t(
  82. 'Once it is configured with the DSN you can call the SDK from anywhere:'
  83. ),
  84. configurations: [
  85. {
  86. language: 'csharp',
  87. code: getVerifySnippet(),
  88. },
  89. ],
  90. },
  91. {
  92. title: t('Troubleshooting'),
  93. description: (
  94. <Fragment>
  95. <p>
  96. {t(
  97. "Confirm the URL doesn't have a trailing whitespace at the end. The Unity Package Manager will fail to find the package if a trailing whitespace is appended."
  98. )}
  99. </p>
  100. {tct(
  101. "If you're running into any kind of issue please check out our [troubleshootingLink:troubleshooting page] or [raiseAnIssueLink:raise an issue].",
  102. {
  103. troubleshootingLink: (
  104. <ExternalLink href="https://docs.sentry.io/platforms/unity/troubleshooting/" />
  105. ),
  106. raiseAnIssueLink: (
  107. <ExternalLink href="https://github.com/getsentry/sentry-unity/issues/new?assignees=&labels=Platform%3A+Unity%2CType%3A+Bug&template=bug.md" />
  108. ),
  109. }
  110. )}
  111. </Fragment>
  112. ),
  113. },
  114. ],
  115. };
  116. const docs: Docs = {
  117. onboarding,
  118. };
  119. export default docs;
  120. const AlertWithoutMarginBottom = styled(Alert)`
  121. margin-bottom: 0;
  122. `;