unity.tsx 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. }: {
  13. dsn?: string;
  14. } = {}): LayoutProps['steps'] => [
  15. {
  16. type: StepType.INSTALL,
  17. description: (
  18. <p>
  19. {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. </p>
  28. ),
  29. configurations: [
  30. {
  31. language: 'bash',
  32. code: 'https://github.com/getsentry/unity.git#1.5.0',
  33. },
  34. ],
  35. additionalInfo: (
  36. <AlertWithoutMarginBottom type="info">
  37. {tct(
  38. '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].',
  39. {
  40. code: <code />,
  41. link: (
  42. <ExternalLink href="https://docs.sentry.io/platforms/unity/configuration/il2cpp/" />
  43. ),
  44. }
  45. )}
  46. </AlertWithoutMarginBottom>
  47. ),
  48. },
  49. {
  50. type: StepType.CONFIGURE,
  51. description: (
  52. <p>
  53. {tct(
  54. "Access the Sentry configuration window by going to Unity's top menu: [toolsCode:Tools] > [sentryCode:Sentry] and enter the following DSN:",
  55. {toolsCode: <code />, sentryCode: <code />}
  56. )}
  57. </p>
  58. ),
  59. configurations: [
  60. {
  61. language: 'bash',
  62. code: dsn,
  63. },
  64. ],
  65. additionalInfo: (
  66. <Fragment>
  67. {t("And that's it! Now Sentry can capture errors automatically.")}
  68. <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. </p>
  75. </Fragment>
  76. ),
  77. },
  78. {
  79. type: StepType.VERIFY,
  80. description: t(
  81. 'Once it is configured with the DSN you can call the SDK from anywhere:'
  82. ),
  83. configurations: [
  84. {
  85. language: 'csharp',
  86. code: `
  87. using Sentry; // On the top of the script
  88. SentrySdk.CaptureMessage("Test event");
  89. `,
  90. },
  91. ],
  92. },
  93. {
  94. title: t('Troubleshooting'),
  95. description: (
  96. <Fragment>
  97. {t(
  98. "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."
  99. )}
  100. <p>
  101. {tct(
  102. "If you're running into any kind of issue please check out our [troubleshootingLink:troubleshooting page] or [raiseAnIssueLink:raise an issue].",
  103. {
  104. troubleshootingLink: (
  105. <ExternalLink href="https://docs.sentry.io/platforms/unity/troubleshooting/" />
  106. ),
  107. raiseAnIssueLink: (
  108. <ExternalLink href="https://github.com/getsentry/sentry-unity/issues/new?assignees=&labels=Platform%3A+Unity%2CType%3A+Bug&template=bug.md" />
  109. ),
  110. }
  111. )}
  112. </p>
  113. </Fragment>
  114. ),
  115. },
  116. ];
  117. // Configuration End
  118. export function GettingStartedWithUnity({dsn, ...props}: ModuleProps) {
  119. return <Layout steps={steps({dsn})} {...props} />;
  120. }
  121. export default GettingStartedWithUnity;
  122. const AlertWithoutMarginBottom = styled(Alert)`
  123. margin-bottom: 0;
  124. `;