Skip to content

Commit af9b6aa

Browse files
authored
feat(unity): Attachment docs (#4493)
* tweaked attachment docs to be more unity specific * removed redundant comment
1 parent 1b7eb0a commit af9b6aa

File tree

3 files changed

+20
-4
lines changed
  • src
    • includes/enriching-events
    • platforms/common/enriching-events/attachments

3 files changed

+20
-4
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
```csharp
2+
using Sentry;
3+
4+
SentrySdk.ConfigureScope(scope =>
5+
{
6+
scope.AddAttachment(Path.Combine(Application.persistentDataPath, "file.log"));
7+
});
8+
```
9+
10+
Note that there are restrictions in place when using paths in combination with [StreamingAssets](https://docs.unity3d.com/2019.4/Documentation/Manual/StreamingAssets.html) and the [Resource folder](https://docs.unity3d.com/ScriptReference/Resources.html).

src/includes/enriching-events/attachment-upload/unity.mdx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
```csharp
22
using Sentry;
33

4-
// Global Scope
54
SentrySdk.ConfigureScope(scope =>
65
{
7-
scope.AddAttachment("log.txt");
6+
scope.AddAttachment(Path.Combine(Application.persistentDataPath, "file.log"));
87
});
98

10-
// Clear all attachments in the global scope
119
SentrySdk.ConfigureScope(scope =>
1210
{
1311
scope.ClearAttachments();

src/platforms/common/enriching-events/attachments/index.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,22 @@ You'll first need to import the SDK, as usual:
8686

8787
</PlatformSection>
8888

89-
<PlatformSection supported={["android", "apple", "java", "dotnet", "dart", "flutter"]}>
89+
<PlatformSection notSupported={["unity"]} supported={["android", "apple", "java", "dotnet", "dart", "flutter"]}>
9090

9191
Attachments live on the <PlatformLink to="/enriching-events/scopes/">Scope</PlatformLink>. You can either add an attachment on the global scope to be sent with every event or add it on the <PlatformLink to="/enriching-events/scopes/#local-scopes">local Scope</PlatformLink> to just send the attachment with one specific event.
9292

9393
<PlatformContent includePath="enriching-events/attachment-upload" />
9494

9595
</PlatformSection>
9696

97+
<PlatformSection supported={["unity"]}>
98+
99+
Unity features a global <PlatformLink to="/enriching-events/scopes/">scope</PlatformLink> to which you add an attachment that will be sent with every event.
100+
101+
<PlatformContent includePath="enriching-events/attachment-upload" />
102+
103+
</PlatformSection>
104+
97105
<Note>
98106

99107
Sentry allows at most 100MB of attachments per event, including the crash report file (if applicable) Uploads exceeding this size are rejected with HTTP error `413 Payload Too Large` and the data is dropped immediately. To add larger or more files, consider secondary storage options.

0 commit comments

Comments
 (0)