Skip to content

Commit

Permalink
updated the place
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsandfoxes committed Mar 4, 2025
1 parent 26f69cd commit 8c5b443
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
---
title: Error Capture
sidebar_order: 60
description: "Learn more about how to configure your SDK to automatically send events to Sentry."
title: Automatic Error Capture
sidebar_order: 10
description: "Learn more about how the SDK automatically captures errors and sends them to Sentry."
---

The Unity SDK relies on two integrations to capture errors: `UnityLogHandlerIntegration` and `UnityApplicationLoggingIntegration`. While they sound similar, they serve different purposes.
The Sentry SDK for Unity provides both automatic and manual error capturing capabilities. This page focuses on the **automatic error capture** through Unity's logging system integrations. For information on manually capturing errors and messages, see the [Usage documentation](/platforms/unity/usage/).

## Automatic Error Capture

The Unity SDK relies on two integrations to automatically capture errors: `UnityLogHandlerIntegration` and `UnityApplicationLoggingIntegration`. While they sound similar, they serve different purposes.

## UnityLogHandlerIntegration

Expand All @@ -14,11 +18,11 @@ The SDK uses the `UnityLogHandlerIntegration` to hook into Unity's logging syste

If [configured](https://docs.unity3d.com/6000.0/Documentation/Manual/stack-trace.html), Unity will include the stack traces with the log messages as raw strings. The SDK is able to parse and display this stack trace in the issues details.

If you're using Unity 6 or newer, you have the option to to enable the source code line numbers in the [player settings](https://docs.unity3d.com/6000.0/Documentation/Manual/il2cpp-managed-stack-traces.html). These line numbers are then part of the stringified stack trace and will be parsed by the SDK. Unfortunately, since there is no native exception at the time of logging, the SDK is not be able to provide line numbers.
If you're using Unity 6 or newer, you have the option to to enable the source code line numbers in the [player settings](https://docs.unity3d.com/6000.0/Documentation/Manual/il2cpp-managed-stack-traces.html). These line numbers are then part of the stringified stack trace and will be parsed by the SDK. Unfortunately, since there is no native exception at the time of logging, the SDK is not be able to provide line numbers otherwise.

<Note>
<Alert>
If you're using a version older than Unity 6, the SDK is unable to provide line numbers for events captured through `Debug.LogError`. Line numbers are not part of the logging information provided by Unity.
</Note>
</Alert>

## UnityApplicationLoggingIntegration

Expand Down
12 changes: 11 additions & 1 deletion docs/platforms/unity/usage/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ Key terms:
- An _event_ is one instance of sending data to Sentry. Generally, this data is an error or exception.
- An _issue_ is a grouping of similar events.
- The reporting of an event is called _capturing_.
When an event is captured, its sent to Sentry.
When an event is captured, it's sent to Sentry.

</Alert>

By default, the Sentry Unity SDK automatically captures errors through Unity's logging system. For details on this automatic error capture, see the [Automatic Error Capture documentation](/platforms/unity/usage/logging-integration/).

In addition to automatic capture, you can manually capture errors, exceptions, and messages as described below.

The most common form of capturing is to capture errors. What can be captured as an error varies by platform. In general, if you have something that looks like an exception, it can be captured. For some SDKs, you can also omit the argument to <PlatformIdentifier name="capture-exception" /> and Sentry will attempt to capture the current exception. It is also useful for manual reporting of errors or messages to Sentry.

While capturing an event, you can also record the breadcrumbs that lead up to that event. Breadcrumbs are different from events: they will not create an event in Sentry, but will be buffered until the next event is sent. Learn more about breadcrumbs in our <PlatformLink to="/enriching-events/breadcrumbs/">Breadcrumbs documentation</PlatformLink>.
Expand All @@ -32,3 +36,9 @@ Another common operation is to capture a bare message. A message is textual info
Messages show up as issues on your issue stream, with the message as the issue name.

<PlatformContent includePath="capture-message" />

<Alert>

The Unity SDK does not provide stack traces for messages.

</Alert>
2 changes: 1 addition & 1 deletion docs/platforms/unity/usage/set-level/index.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Set the Level
description: "The level - similar to logging levels - is generally added by default based on the integration. You can also override it within an event."
sidebar_order: 5
sidebar_order: 20
---

The level - similar to logging levels - is generally added by default based on the integration. You can also override it within an event.
Expand Down

0 comments on commit 8c5b443

Please sign in to comment.