Unityunity_crashreporting_bugsplat_small

6 minute read

The BugSplat Unity package handles all installation or update of the needed files. Double click on this file to launch Unity, create or select a project, and the BugSplat tool will be imported. After unpacking, the tool will be ready to be used. (Note: At least for our team, Mac users have to manually import the package contents.)

Exploring the BugSplat Sample

To get a feel of the BugSplat service before using it in your application, try out the debug scene embedded as a sample in the BugSplat Report Tool.

Double-click the debug scene icon found in the projects tab.

Unity, crash report, crash reporting

Hit the Play button and you will see our example running as shown below. The scene consists of three test buttons and an animated cube.

The Prompted Exception button will send an interactive crash report. A pop-up dialog will ask the user to provide some information and confirm that the crash report should be sent to BugSplat.

The Custom Exception button will create a report using a custom Exception (i.e., created using throw new Exception(“msg”).

The Null Reference Exception button will force a Null Reference Exception (i.e., a common runtime exception in Unity).

Unity, crash report, crash reporting

By default, crashes are posted to the BugSplat database ‘Fred’. Login at the BugSplat website with username Fred and password Flintstone to view these crash reports.

If you would like to post crashes to your own database, select the app GameObject and it will show the Reporter variable Inspector. Provide your own values for Database, App, Version and the optional Key parameters.

Unity, crash report, crash reporting

Integrating Into Your Game


Follow the steps below to create a Reporter instance that will handle the detection of Errors and also allow users to send their own reports to the BugSplat server.

  1. Create an empty script or use one already created.
  2. Create a Reporter variable. Don’t forget to add using BugSplat; directive.
  3. Unity, crash report, crash reporting
  4. On the Start or Awake method call reporter.Initialize(gameObject) so it will start watching for Exceptions.
  5. Add your script to a GameObject and check that the reporter Inspector is available. Unity, crash report, crash reporting
  6. Configure and fill the fields with data of your BugSplat account:
  7. FieldDescription
    DatabaseTarget database where reports will be sent
    AppApp name string
    VersionVersion string of the app
    QuietFlag that allows ReportComponent to emit debug logs so the user can confirm things are working
    PreviousLast sent report
    Generate ScreenshotsFlag that allows the capture of screenshots before a Report is generated
    Generate Log FileFlag that allows the creation of a text file with all logs before the Report
    PromptFlag that allows the use of a dialog before sending a Report
    IgnoredNumber of ignored repeated reports
    LogsList of detected Unity logs
    IgnoredNumber of ignored repeated reports
    CountNumber of Reports sent

Exporting


Standalone

  1. File > Build Settings..
  2. Add Open Scenes
  3. Use the following settings to get function names and line numbers
  4. Unity, crash report, crash reporting
  5. Click Build
  6. Select a folder for the Windows Store Visual Studio project to be saved in
  7. Open the newly created project in Visual Studio
  8. Add the Internet (Client) permission to the Package.appxmanifest file
  9. Unity, crash report, crash reporting Unity, crash report, crash reporting Unity, crash report, crash reporting
  10. Run your app with Visual Studio and click continue when it catches an exception