BugReportTool is a small Unity utility that helps you collect in-game bug reports from players and automatically upload them to Dropbox.
A simple Unity error reporting tool that collects player reports and Unity log files, compresses them into a ZIP, and uploads the result to Dropbox. This is not a production-ready tool; it is published only as a reference and a starting point for developers building their own reporting workflow.
It:
- Saves a short summary and a detailed description written by the player
- Gathers Unity log files into a temporary folder
- Compresses that folder into a
.ziparchive - Uploads the resulting zip file to your Dropbox account
UnityBugReportToolVideo.mp4
- In-game bug report UI (summary + detail text fields)
- Automatic inclusion of Unity log and report files:
Player.logPlayer-prev.log(if present)PlayerReport.txt(player-written report)
- Creates a
BugReportFile.ziparchive with all collected files - Uploads the archive to Dropbox
- Date-based folder structure in Dropbox:
/YYYY-MM-DD/ - File name based on the sanitized summary text
- Date-based folder structure in Dropbox:
- Disables the submit button while the upload is in progress (to prevent double submits)
- Unity 2022.3.62f2 (or a compatible 2022.3 LTS version)
- The following Unity packages / external libraries:
- TextMeshPro (official Unity package)
- Unity.SharpZipLib (used to compress the folder into a zip)
- A Dropbox API Access Token (created for your Dropbox account)
-
Clone or download the project
- Clone this repository from GitHub.
- Open it with Unity Hub.
-
Open the scene
- Open the scene:
Assets/Scenes/BugReportPanel.unity.
- Open the scene:
-
Check the BugReportManager component
- In the
BugReportPanelscene, locate the GameObject that hosts the bug report UI.
Make sure theBugReportManagerscript is attached.
- In the
-
Assign UI references
- In the
BugReportManagercomponent:m_SummaryField→TMP_InputFieldused for the short summarym_DetailField→TMP_InputFieldused for the detailed descriptionm_SubmitButton→Buttonthat sends the bug report
- Drag and drop the corresponding UI elements from the hierarchy into these fields in the Inspector.
- In the
-
Set the Dropbox Access Token
- In the
BugReportManagercomponent, set:m_DropboxAccesTokento your Dropbox Access Token.
- For production use:
- Avoid hard-coding or exposing this token directly in the client.
Prefer a secure backend, configuration service, or encrypted storage.
- Avoid hard-coding or exposing this token directly in the client.
- In the
-
User fills out the form
- The player types a short summary and a detailed description.
- The player clicks the submit button.
-
Creating the text report
GetPlayerReportText()writesPlayerReport.txtunderApplication.persistentDataPath.- The file content is:
- First lines: summary
- Then: detailed description
-
Preparing the report folder
CreateReportFolder():- Creates a temporary folder
BugReportTempunderApplication.temporaryCachePath. - If present, copies:
Player.log→BugReportTemp/Player.logPlayer-prev.log→BugReportTemp/PlayerReport.txt(note: name collision, see below)PlayerReport.txt→BugReportTemp/PlayerReport.txt
- Creates a temporary folder
-
Compressing the folder
CompressReportFolder(tempFolder):- Compresses
BugReportTempinto
Application.persistentDataPath/BugReportFile.zip. - Deletes the temporary folder afterward.
- Compresses
-
Uploading to Dropbox
UploadCompressedFolder(byte[]):- Creates a date-based folder name:
yyyy-MM-dd. - Sanitizes the summary text to build a safe file name:
- If empty: falls back to
report - Removes/normalizes special characters and whitespace
- Truncates to max 50 characters
- If empty: falls back to
- Final path format:
/YYYY-MM-DD/sanitized_summary.zip
- Creates a date-based folder name:
- The
UploadToDropbox(...)coroutine:- Calls Dropbox
files/create_folder_v2for/YYYY-MM-DD.- If it returns 409, the folder already exists (this is fine).
- Uploads the contents of
BugReportFile.zipviafiles/upload. - Re-enables the submit button when finished.
- Calls Dropbox
-
Dropbox Access Token security
- The sample stores the token directly in a serialized field on the MonoBehaviour.
- For real-world projects, you should:
- Never ship permanent tokens inside a public client build.
- Prefer a secure backend that issues short-lived tokens or proxies the upload.
-
Log file locations
- On different platforms, Unity log files may live in different folders.
- This project assumes
Player.logandPlayer-prev.logare underApplication.persistentDataPath. - Adjust
CreateReportFolder()to match your actual log file locations if needed.
-
Potential improvements
Player-prev.logis currently copied asPlayerReport.txt, which can overwrite the real report file.
It is safer to copy it asPlayer-prev.loginstead.- Add a progress indicator or UI feedback for upload success/failure.
- Show user-facing error messages when the upload fails (e.g., via a popup).
- You add a "Report a Bug" button to your game.
- When the player clicks it:
- You show or load the
BugReportPanelscene.
- You show or load the
- The player:
- Writes a short summary (like a title).
- Describes in detail what happened, expected vs actual behavior, steps to reproduce, etc.
- Clicks the submit button.
- As a developer, you:
- Open the date folder in Dropbox.
- Download the zip file.
- Inspect the player report, log files, and any other artifacts you decide to include in the future.
- Feel free to open GitHub Issues for bugs, feature requests, or questions.
- Before submitting a Pull Request:
- Make sure the project compiles and the bug report flow works.
- Add a short description and, if possible, screenshots or GIFs of UI changes.
(This example applies only to Dropbox. Adjust according to your own application.)
This project uses the Dropbox API to upload reports. For that, you need a Dropbox account and an app with an Access Token.
-
Create a Dropbox account
- Go to https://www.dropbox.com.
- Create a free account or sign in with your existing one.
-
Open the Dropbox App Console
- Visit https://www.dropbox.com/developers/apps.
- Click Create app (or Create new app).
-
Create a new app
- Choose Scoped access as the API type (recommended).
- Choose the access type:
- If you only need a dedicated folder for this app: App folder
- If you really need access to the whole Dropbox: Full Dropbox (be careful for security).
- Give your app a name and click Create app.
-
Configure permissions (scopes)
- On the app page, go to the Permissions (or Scoped access / Permissions) tab.
- Enable the scopes that allow reading/writing files, for example:
files.content.write,files.content.read(exact names may change over time; look for file read/write permissions).
-
Generate an Access Token
- On the app page, go to Settings or App settings.
- Find the Generated access token or OAuth 2 / Generated access token section.
- Click Generate (or Generate access token).
- Copy the generated Access Token.
-
Add the token to your Unity project
- In Unity, select the
BugReportManagercomponent. - In the Inspector, paste the token into the
m_DropboxAccesTokenfield. - Keep this token secret; don’t commit it to public repos or show it in screenshots.
- In Unity, select the
Note: For a real production setup, you should not ship a permanent token directly in the client. Instead, use a backend service to issue short-lived tokens or proxy the upload securely.