Skip to content

Commit 15301b7

Browse files
authored
feat(godot): Enriching events with scene tree data (#13531)
1 parent 8490159 commit 15301b7

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed

docs/platforms/godot/configuration/options.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ If enabled, the SDK will try to take a screenshot and attach it to the event.
102102

103103
</ConfigKey>
104104

105+
<ConfigKey name="attach-scene-tree">
106+
107+
If enabled, the SDK will capture and attach scene tree information to events. The scene tree data is attached as a `view-hierarchy.json` file, and you can explore it in the "Scene Tree" section of each issue that includes this attachment. This provides valuable context about your game's scene tree at the time of the error. See <PlatformLink to="/enriching-events/view-hierarchy/">Scene Tree</PlatformLink> for more details.
108+
109+
</ConfigKey>
110+
105111
## Error Logger Options
106112

107113
<ConfigKey name="logger-enabled">
89.4 KB
Loading
106 KB
Loading
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: "Scene Tree"
3+
description: "Learn more about capturing scene tree data during errors and crashes. Sentry provides a visual representation of your game's scene tree at the time of failure, giving you additional insight into issues."
4+
---
5+
6+
Sentry captures a JSON representation of engine's scene tree during errors and crashes, adding it to the event as an attachment. This feature is also known as View Hierarchy in Sentry.
7+
8+
<Alert title="Note">
9+
10+
This process can only be performed on the main thread, which means it may not be available during events that happen on threads other than the main thread. Additionally, if an error occurs before the scene tree is initialized, this information cannot be captured. Inherently, this feature should be considered a best-effort solution.
11+
12+
</Alert>
13+
14+
## Enabling Scene Tree Attachments
15+
16+
Scene tree capturing is an opt-in feature. To attach scene tree information to your events, navigate to **Project Settings > Sentry > Options** and enable the **Attach Scene Tree** option:
17+
18+
![Project Settings Screenshot](./img/project-settings.png)
19+
20+
Or, like so, if you're <PlatformLink to="/configuration/options/">configuring things programmatically</PlatformLink>:
21+
22+
```GDScript
23+
extends SentryConfiguration
24+
25+
func _configure(options: SentryOptions):
26+
options.attach_scene_tree = true
27+
```
28+
29+
## Viewing Scene Tree Attachments
30+
31+
Scene tree information is attached as `view-hierarchy.json` file. You can find it in the "Attachments" tab, where you can view all attachments, as well as associated events. Click the event ID to open the [Issue Details](/product/issues/issue-details) page of that specific event.
32+
33+
<Include name="common-imgs/viewhierarchy-list-example" />
34+
35+
On the **Issue Details** page, you can interact with the scene tree attachment in a section called "Scene Tree". This section represents the state of your scene tree at the time of an error event. There are two displays: a tree view, and detailed view for a selected node. You can select nodes in the tree to view the properties collected by the SDK. The SDK will report on the following keys for each node in the view:
36+
37+
- `name`: The name of the node.
38+
- `class`: Built-in class of the node.
39+
- `script`: The file path of the script attached to the node. Only nodes with a script attached include this property.
40+
- `scene`: The original scene's file path, if the node has been instantiated from a PackedScene file. Only scene root nodes include this property.
41+
42+
This feature provides a snapshot of your game's scene tree structure at the moment of error, making it easier to identify which nodes were active or gain a better understanding of the relationship between the nodes.
43+
44+
![Scene Tree Example](./img/scene-tree-example.png)

0 commit comments

Comments
 (0)