Configuration options

Some Bugsnag settings can be configured from the Unity Inspector, but you can also change settings inside your scripts:

AppVersion

If you want to manually track in which versions of your application each exception happens, you can set AppVersion.

Bugsnag.Configuration.AppVersion = "1.2.3-alpha";

AutoCaptureSessions

Set to true if you would like Bugsnag to automatically capture sessions. Auto capturing sessions only works when using the provided MonoBehaviour to configure Bugsnag.

Bugsnag.Configuration.AutoCaptureSessions = false;

If you want control over what is deemed a session, you can manage the session lifecycle using StartSession(), StopSession() and ResumeSession().

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.Configuration.AutoNotify = false;

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.Configuration.Context = "Space Port";

Endpoint

By default Bugsnag sends exceptions to bugsnag.com, if you’re running Bugsnag On-premise, you can change this to point to your local Bugsnag server:

Bugsnag.Configuration.Endpoint = new Uri("http://bugsnag.internal.example.com");

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.Configuration.NotifyLevel = LogType.Error;

NotifyReleaseStages

By default, we notify Bugsnag of all exceptions that happen in your app. If you would like to change which release stages notify Bugsnag of exceptions you can set the notifyReleaseStages property:

Bugsnag.Configuration.NotifyReleaseStages = new [] { "staging", "production" };

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.Configuration.ReleaseStage = "development";

By default this is set to be production if the build is a release build, and development for a debug build.

ReportUncaughtExceptionsAsHandled

The “unhandled” property of a report indicates that a crash may have occurred in a given session and reduces the stability score of the project. By default, only crashes from iOS and Android native crash handlers are reported as unhandled. To report both Exception-level log events from Unity and native crashes from iOS and Android as unhandled events, set this property to false:

Bugsnag.Configuration.ReportUncaughtExceptionsAsHandled = false;

ResumeSession

Resumes a session which has previously been stopped, or starts a new session if none exists. If a session has already been resumed or started and has not been stopped, calling this method will have no effect. You should disable automatic session tracking via AutoCaptureSessions if you call this method.

It’s important to note that sessions are stored in memory for the lifetime of the application process and are not persisted on disk. Therefore calling this method on app startup would start a new session, rather than continuing any previous session.

You should call this at the appropriate time in your application when you wish to resume a previously started session. Any subsequent errors which occur in your application will be reported to Bugsnag and will count towards your application’s stability score.

Bugsnag.ResumeSession();

Also see StartSession and StopSession.

SessionEndpoint

When using an on-premise version of Bugsnag you will want to change the endpoint that the notifier sends session information to. You can do that by setting SessionEndpoint.

Bugsnag.Configuration.SessionEndpoint = new Uri("http://bugsnag.internal.example.com");

StartSession

Starts tracking a new session. You should disable automatic session tracking via AutoCaptureSessions if you call this method.

You should call this at the appropriate time in your application when you wish to start a session. Any subsequent errors which occur in your application will be reported to Bugsnag and will count towards your application’s stability score. This will start a new session even if there is already an existing session; you should call ResumeSession if you only want to start a session when one doesn’t already exist.

Bugsnag.StartSession();

Also see ResumeSession and StopSession.

StopSession

Stops tracking a session. You should disable automatic session tracking via AutoCaptureSessions if you call this method.

You should call this at the appropriate time in your application when you wish to stop a session. Any subsequent errors which occur in your application will still be reported to Bugsnag but will not count towards your application’s stability score. This can be advantageous if, for example, you do not wish the stability score to include crashes in a background service.

Bugsnag.StopSession();

Also see ResumeSession and StartSession.

User

Bugsnag helps you understand how many of your users are affected by each error. In order to do this, we send along a userId with every exception. By default we will generate a unique ID and send this ID along with every exception from an individual device.

If you would like to override this User Id, for example to set it to be a username of your currently logged in user, you can set the User Id property:

Bugsnag.User.Id = "userId";
Bugsnag.User.Name = "User Name";
Bugsnag.User.Email = "user@email.com";

You can also set the email and name of the user and these will be searchable in the dashboard.

Displaying the file for non-debug Unity builds

Filenames for Stacktraces may not be available in production builds, due to optimizations in Unity which remove this information. Currently we display ‘unknown file’ in this scenario.