Skip to content

feat: Added Unity UserFeedback Prefab #14667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 44 additions & 7 deletions docs/platforms/unity/user-feedback/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,58 @@ description: "Learn more about collecting user feedback when an event occurs. Se
sidebar_order: 6000
---

When a user experiences an error, Sentry provides the ability to collect additional feedback. You can collect feedback according to the method supported by the SDK.
<Alert level="info">

## Use the .NET SDK
The User Feedback Prefab is available in Unity SDK version 4.0.0, which is currently in beta.

<Alert>
</Alert>

User Feedback for **[ASP.NET](/platforms/dotnet/guides/aspnet/user-feedback/#integration)** or **[ASP.NET Core](/platforms/dotnet/guides/aspnetcore/user-feedback/#integration)** supply integrations specific to supporting those SDKs.
When a user experiences an error, Sentry provides the ability to collect additional feedback. The Unity SDK provides both a simple prefab-based solution and a programmatic API for collecting user feedback.

</Alert>
## Use the User Feedback Prefab

The Unity SDK includes a ready-to-use prefab that provides a complete user feedback solution. This prefab contains:

- A feedback button (megaphone icon) that opens the feedback form
- A feedback form with fields for:
- Name (optional)
- Email (optional)
- Message/feedback (required)
- Screenshot (optional, taken automatically)

### Adding the Prefab to Your Scene

1. Drag and drop the User Feedback prefab from the Unity SDK package into any scene
2. The prefab includes a scaling canvas that works across different screen sizes and resolutions
3. The prefab is ready to use immediately without any additional configuration

### Default Appearance

The User Feedback prefab includes a megaphone button that triggers the feedback form:

You can create a form to collect the user input in your preferred framework, and use the SDK's API to send the information to Sentry. You can also use the widget, as described below. If you'd prefer an alternative to the widget or do not have a web frontend, you can use this API:
![Megaphone Button](./img/Megahpone.png)

When clicked, the feedback form appears with fields for user input:

![Feedback Form](./img/FeedbackForm.png)

### Customization

You can customize the feedback form by:

- Creating a prefab variant to inherit from the original while allowing updates
- Removing optional fields (name, email) by deleting them from the VerticalLayoutGroup
- Modifying the appearance and styling of the form elements
- The prefab comes with a custom inspector that highlights missing or broken references:
- Missing optional fields are highlighted in yellow
- Missing required fields are highlighted in red

## Use the .NET SDK API

If you prefer to create your own feedback form or need programmatic control, you can use the SDK's API to send feedback to Sentry:

```csharp {tabTitle:C#}
var eventId = SentrySdk.CaptureMessage("An event that will receive user feedback.");

SentrySdk.CaptureFeedback("It broke.", "[email protected]", "The User", associatedEventId: eventId);
```

Loading