The Bugsnag Notifier for Unity gives you instant notification of exceptions thrown from your Unity games on iOS and Android devices. Exceptions in your Unity code (JS, C# and Boo) as well as native crashes (Objective C, Java) are automatically detected and sent to Bugsnag.
Bugsnag captures errors in real-time from your web and mobile apps, helping you to understand and resolve them as fast as possible. Create a free account to start capturing exceptions today.
-
Download & Import the Bugsnag Unity Package
Download the latest Bugsnag Unity Notifier. Double click the
.unitypackagefile, then click the import button to import Bugsnag into your Unity project. -
Create a Bugsnag GameObject
Create a new
GameObjectwithin your first/main scene (GameObject Menu -> Create Empty), and rename it to Bugsnag. -
Add the Bugsnag Component to Your GameObject
With your new GameObject selected, add the Bugsnag component (Component Menu -> Scripts -> Bugsnag).
-
Configure Your API Key
Finally, configure your Bugsnag API Key in the component inspector. You can find your API key on the Project Settings page on your Bugsnag dashboard.
When building for Android, you'll need to make sure that Internet Access is enabled. On the Android tab of the Unity Player Settings screen, make sure Internet Acess is set to Require.
If you would like to send non-fatal exceptions to Bugsnag, you can pass any
Throwable object to Bugsnag's notify method in your Unity scripts:
Bugsnag.Notify(new System.InvalidOperationException("Non-fatal"));Alternatively, you can change the Bugsnag NotifyLevel setting
(see below) to send Debug.Log* events to Bugsnag.
If you would like to add custom data to your Bugsnag error reports, you can
use the AddToTab method. Custom data is displayed inside tabs on each
exception on your Bugsnag dashboard.
Bugsnag.AddToTab("user", "username", "bob-hoskins");
Bugsnag.AddToTab("user", "registered_user", "yes");This will add a user tab to the error report on your Bugsnag dashboard containing the username and registration status of your user.
Most Bugsnag settings can be configured from the Unity Inspector, but you can also change settings inside your scripts:
###AutoNotify
By default, we will automatically notify Bugsnag of any fatal exceptions (crashes) in your game. If you want to stop this from happening, you can set the Auto Notify property in the Unity Inspector.
You can also change this setting in your scripts as follows:
Bugsnag.AutoNotify = false;###NotifyLevel
By default, Bugsnag will be notified about any Exception logged to
Debug.LogException. You can send additional log information to Bugsnag
(eg. all Debug.LogError messages) by changing the Notify Level property
in the Unity Inspector.
You can also change this setting in your scripts as follows:
Bugsnag.NotifyLevel = LogSeverity.Error;###NotifyUrl
By default Bugsnag sends exceptions to bugsnag.com, if you're running Bugsnag Enterprise, you can change this to point to your local Bugsnag server:
Bugsnag.NotifyUrl = 'http://bugsnag.internal.example.com';###Context
Bugsnag uses the concept of contexts to help display and group your errors. Contexts represent what was happening in your game at the time an error occurs. By default, this will be set to be your currently active Unity Scene.
If you would like to set the Bugsnag context manually, you can set the
Context property in your scripts:
Bugsnag.Context = "Space Port";###ReleaseStage
If you would like to distinguish between errors that happen in different
stages of your game's release process (development, qa, production, etc)
you can set the ReleaseStage in your scripts:
Bugsnag.ReleaseStage = "development";By default this is set to be production if the build is a release build, and development for a development build.
First clone this repository
git clone --recursive [email protected]:bugsnag/bugsnag-unity
Then run the Rake task:
rake build
This will generate a Bugsnag.unitypackage file which you can drag into your Unity projects.
Please report any bugs or feature requests on the github issues page for this project here:
https://github.com/bugsnag/bugsnag-unity/issues
- Fork the notifier on github
- Commit and push until you are happy with your contribution
- Make a pull request
- Thanks!
The Bugsnag Unity notifier is free software released under the MIT License. See LICENSE.txt for details.




