Is there a way to set metadata for a crash report just before it’s sent? I’m thinking about reporting some data that varies constantly from frame to frame like the framerate, the ping or the time since the start of the game. If there was an event or a callback when a crash report is ready to be sent, that would be perfect. If it doesn’t exist, is it something that is on the roadmap?
I have tried that this afternoon. My only issue with that method is that I need to keep updating the values each frame instead of being able to set the data when the crash happens to have the most accurate values. For example, if I wanted to send the time since the game has started, I would have to do it like this:
I would like add to what @Djadjouka is propossing. Additional to having a callback for when a crash report is genereated, it would also be a great function to be able to force sending a crash report. Some times, part of our code has to be handled in a try … catch to prevent leaving the execution on an inconsistent state, but it would be very helpfull if we still got the crash report. Currently, only Unhandled exceptions are reported. So, something like this would be great:
private void SomeAction()
{
try
{
// Work that can fail.
}
catch (Exception ex)
{
// Do something to handled the exception
CrashReport.Send(ex);
}
}
In the example above, after handling the exception, we are still reporting it. That would also be a great place where user metadata can be added to the crash report.
Hi @Djadjouka and @emmanuelsolis , thank you for the awesome suggestions! The callback feature is already in our backlog of features that we’d like to add.
For the second issue regarding being able to manually send crash reports, you can actually accomplish that by calling Debug.LogException() in your code. These will still send out exception reports while allowing you to properly handle the exception.
Hi @Can-Baycay ! Unfortunately we don’t have an ETA yet on the callback feature. But we’ll be sure to update everyone here when we’re close to announcing something.
It looks like the callback never came? Making the class UnityEngine.CrashReportHandler.CrashReportHandler useless and potentially dangerous - the game will carry on, not understanding that something went wrong and that very-very-very often have secondary problems emerging down the line. Up to and including completely ruined savegame files. That is a disaster for players.