Setting up Crash and Exception Reporting
Enable Crash and Exception Reporting in the Unity Editor, and configure advanced custom metadata for detailed crash reports.
Read time 2 minutesLast updated 2 days ago
Before setting up Crash and Exception reporting for your project, make sure you’ve followed the basic setup requirements outlined in our Getting Started guide. It’s important to have a Project ID to connect the project to the Unity Dashboard. Once your Dashboard is set up with your basic project credentials, you can enable Crash and Exception Reporting for your project in the Unity Editor.
To enable Crash and Exception Reporting:
- Open your project in the Unity Editor.
- From the Unity Editor menu, select Window > General > Services to open the Services window.
- From the Services window, select Cloud Diagnostics.
- Select the toggle beside Crash and Exception Reporting to turn on the service.
Setting up customized reports with Advanced Cloud Diagnostics
By default, crash and exception reports are configured with standard metadata such as device OS. With Advanced Cloud Diagnostics, you can also add custom metadata for even more debugging capacity. This custom metadata can be captured at any point, such as when the game first initializes, a new level loads, or even when the player takes a specific action. Crash and exception reports include a CrashReportHandler class for configuring crash reports and custom metadata. Use the SetUserMetadata method to add up to 64 custom metadata entries to your report. Request a new piece of metadata to track with this statement:UnityEngine.CrashReportHandler.CrashReportHandler.SetUserMetadata(“key”, “value”);
Triggering a test report
Test the Cloud Diagnostics service by triggering a report and viewing it within the Unity Dashboard. Create a report by throwing an exception or logging an exception message via the Debug.LogException()method. To do this, locate a method within your C# script where you’d like the test exception to occur, such as the one that runs when the first screen is loaded, and add the following line:Save the script and run your game in Play Mode. You should be able to view the Debug.LogException message in your console within the Editor.Debug.LogException(new Exception(“Testing Cloud Diagnostics reports”));
Viewing your test report
View Cloud Diagnostic reports from the Unity Dashboard:- In the Unity Dashboard, go to Development > Products.
- Select Cloud Diagnostics.
- Select Crash and Exception Reporting.
- In the Problems section, select the title of the test report to view its data.
Setting up notifications for new reports
Cloud Diagnostics supports report notifications via integration so you can connect your development workflow to non-Unity tools. Instead of manually checking the Dashboard to see if any new problems have been reported, you can instead receive a notification via 3rd party integrations such as email, Slack, Discord, Trello, and more. To set up report notifications:- In the Unity Dashboard, select Home > Projects.
- Select your project.
- Note: Make sure you’ve enabled Crash and Exception reporting for this project before setting up report notifications.
- In the primary navigation menu, select Development > Settings.
- In the Project Integrations section, select New Integration.
- Select the type of integration you want to add.
- Enter the connection details and settings for your chosen integration service.
- Depending on your integration, select Create or Connect.