Documentation

Cloud Diagnostics

Cloud Diagnostics

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

Important
Cloud Diagnostics is deprecated, and will be phased out in future versions of Unity. For more robust reports and device information, including information on Application Not Responding (ANR) errors for Android, use the diagnostics experience available in Unity 6.2 and later. For information about migrating from Cloud Diagnostics, refer to Migrate to Diagnostics in the Unity Dashboard.
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:
  1. Open your project in the Unity Editor.
  2. From the Unity Editor menu, select Window > General > Services to open the Services window.
  3. From the Services window, select Cloud Diagnostics.
  4. 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:
Debug.LogException(new Exception(“Testing Cloud Diagnostics reports”));
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.

Viewing your test report

View Cloud Diagnostic reports from the Unity Dashboard:
  1. In the Unity Dashboard, go to Development > Products.
  2. Select Cloud Diagnostics.
  3. Select Crash and Exception Reporting.
  4. 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:
  1. In the Unity Dashboard, select Home > Projects.
  2. Select your project.
    • Note: Make sure you’ve enabled Crash and Exception reporting for this project before setting up report notifications.
  3. In the primary navigation menu, select Development > Settings.
  4. In the Project Integrations section, select New Integration.
  5. Select the type of integration you want to add.
  6. Enter the connection details and settings for your chosen integration service.
  7. Depending on your integration, select Create or Connect.

Batch mode support

As of 2018.4.1+ and 2019.1.3+, native crash reporting is now supported when running Unity in -batchmode. Native crash reporting is also supported when running apps as a Server Build. Be sure to specify both -username and -password in the command line when running in batch mode to avoid running into a USYM_UPLOAD_AUTH_TOKEN error.

What’s next?

Now that you’ve enabled Crash and Exception reports, learn how to understand and manage them.