sentry-unity
sentry-unity copied to clipboard
feat: User Feedback
Fixes https://github.com/getsentry/sentry-unity/issues/928
Goal
The idea is to provide users a simple to use prefab to add to their game to allow players to provide user feedback. This is a first iteration and the things we're looking to have added to the feedback is:
- Name (optional)
- Email (optional)
- A message - i.e. feedback (required)
- Screenshot (optional)
How it's done
A prefab that holds a GameObject with a scaling canvas that can be dropped into any scene. The prefab consists of two parts:
- The button to pop up the form
- The form to submit the feedback
They are both part of the same prefab as it make little sense to provide them separately to customize them. If you were to customize one we'd need a way to provide the other one a reference which would be a pita to support.
How to allow for customization
The prefab can be dragged into the /Assets allowing for the creation of a prefab variant. This variant "inherits" from the original and all values that have not been explicitly changed will get updated.
Adding to the scene
Adding the User Feedback to the scene can be done via drag&drop:
https://github.com/user-attachments/assets/ee43982f-8adb-472a-903b-2ce7ea903e05
In Action
Clicking the megaphone button pops up the form to submit user feedback.
https://github.com/user-attachments/assets/8b114262-8a0c-483d-b21a-c885930e65b3
Since the canvas scales with the screen, this should work on a very wide range of displays and resolutions, i.e. mobile
When submitting the report we're delaying to send it to the EndOfFrame so the screenshot does not contain the form.
Custom Inspector - A defensive approach
We're handing users a prefab with its own SentryUserFeedbackMonoBehaviour. We need to be defensive about how it's going to be used. That's why it comes with it's own custom inspector to highlight broken or missing references
TODO:
Fix the commented ScreenshotEventProcessor tests