BugSplat crash reporting for Unity supports both Windows Native and Cross-Platform .NET error reporting. Our native support captures both native C++ and mono based .NET call stacks with function names and line numbers. Our cross-platform .NET support captures exceptions on Windows, UWP, OS X and Linux. Combining the two provides powerful insight into the stability of your application.
In order to integrate BugSplat with your Unity project, please make sure you have downloaded the BugSplatUnity SDK here.
BugSplat collects Unity crash files in order to provide both Windows Native and .NET call stacks. This is especially valuable for games that utilize C++ libraries and plugins. We have provided a sample application MyUnityCrasher that demonstrates a working BugSplatUnity integration. Please note that collection of crashes that occur when running inside the Unity editor is not supported at this time, but we plan to add support in a future release.
In your Assets/Plugins
directory, create two subfolders: Assets/Plugins/x86
and
Assets/Plugins/x86_64
.
Copy the appropriate version of BugSplatUnity.dll
and BugSplatUnity.pdb
into each of
these folders:
Copy BugSplat/samples/MyUnityCrasher/Assets/Code/BugSplat.cs
to your Assets directory:
At your application’s entry point add a call to BugSplat.Init
and pass it your
database
, company name
,
product name
, product version
, user description
and flags
.
Set flags to 0
to show the BugSplat dialog at crash time and remove the dmp file upon successful
crash
upload.
To hide the crash report dialog pass the BugSplat.MDSF_NONINTERACTIVE
flag.
To leave the dmp file on disk pass the BugSplat.MDSF_LOGCONSOLE
flag.
Use the bitwise OR operator to combine flags.
Additionally you can use BugSplat.AddAdditionalFile
, BugSplat.RemoveAdditionalFile
,
BugSplat.SetDefaultUserDescription
, BugSplat.SetDefaultUserEmail
and
BugSplat.SetDefaultUserName
to
further customize your BugSplat configuration:
Add a call to BugSplat.NativeCrash
so that you can test BugSplat. Remove this call after you have
successfully integrated BugSplat:
Create a post build step if you don’t already have one. Add a method that copies BugSplat to your
application’s output directory. NOTE: the build script must be inside a folder named Editor
otherwise
Unity will not resolve the Unity.Editor
reference correctly. Please refer to the
MyUnityCrasher
sample for
full implementations of CopyPluginSymbols
, CopyRuntimeSymbols
and
CopyBugSplat
:
In order to get good call stacks you will need to upload symbols for each unique build. Add another
method to your post build step that runs SendPDBs.exe. If you
haven’t made and changes to your plugins you
can use Ctrl+C
to skip the SendPDBs
dialog. This step can also be added to the end of
your build pipeline
instead:
Build your game with the Copy PDB files
option selected:
Navigate to the Crashes page.
You should see a new crash report.
Clicking the crash’s ID
will redirect you to the Crash
page which will show you
detailed information about the crash:
Notice the Crash
page contains the native call stack from the dump file generated by Unity. To
see the mixed-mode call stack from output_log.txt
, see the Other Threads
tab.
That’s it! Your game is configured to post native crash reports to BugSplat. Good luck!
The BugSplatUnity.unitypackage file contains everything you need to integrate BugSplat into your. Once you've downloaded BugSplatUnity SDK, double-click the unitypackage file to launch Unity. You will be prompted to create or select a project. Once you've selected a project, click "Import" to import BugSplat. After the import is complete, the tool will be ready to use.
(Note: At least for our team, Mac users have to manually import the package contents.)
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 at
Assets > bugsplat > report > scene > debug
.
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 create an interactive crash report dialog that allows the user to provide information and confirm 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).
By default, crashes are posted to the BugSplat database "fred@bugsplat.com". Login to BugSplat with the username fred@bugsplat.com and password Flintstone and navigate to the Crashes page to view these crash reports.
If you would like to post crashes to your own database, select the app GameObject and in the Inspector expand the Reporter field. Provide your own values for Database, App, Version and the optional Key parameters.
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.
using BugSplat;
to add the BugSplat namespace to your script.
public Reporter reporter;
to add a Reporter as a public property.
reporter.Initialize(gameObject);
to configure BugSplat
to start watching for Exceptions.
Field | Description |
---|---|
Database | Target database where reports will be sent |
App | App name string |
Version | Version string of the app |
Quiet | Flag that allows ReportComponent to emit debug logs so the user can confirm things are working |
SetCallback | Action<bool, string> that will be called after BugSplat report is posted. Callback will be passed a bool indicating if the post was successful as well as the response from the server. |
Previous* | Last sent report |
Generate screenshot d-blocks | Flag that allows the capture of screenshot d-blocks before a Report is generated |
Generate Log File | Flag that allows the creation of a text file with all logs before the Report | Prompt | Flag that allows the use of a dialog before sending a Report |
Ignored | Number of ignored repeated reports |
Logs | List of detected Unity logs |
Ignored | Number of ignored repeated reports |
Count | Number of Reports sent |