https://metaplay.io logo
Log an incident from Unity to the Dashboard withou...
# questions-and-feedback
a
Hey, can I report an incident from Unity to show in the Dashboard without throwing an exception? Like just a logging error call.
j
Hey, Creating your own incident reports is not really documented at the moment but you can do it, take a look at
IncidentReportFactory
and
PlayerIncidentReport
.
If you wish to add your own components to the dashboard, you can use the
Custom components
[feature](https://docs.metaplay.io/liveops-dashboard/how-to-guides/customizing-the-liveops-dashboard-frontend.html#add-custom-components) and register it for
PlayerIncidents/Details
. Note that if the incident report is not your type or does not contain your custom data, the component should not render anything. (They're always included in the page)
a
ok lots of cool stuff there. i'd actually just like to report incidents in a default way, they could show like the exceptions do, i don't need custom components now i wonder if i need to add some new type for it or could just use existing ones. one a bit hackish trick might be to create an exception object, just as a normal variable without throwing anything, and then call this with it MetaplaySDK.IncidentTracker.ReportUnhandledException(ex);
oh and actually in my first cases now I'm first catching exceptions anyway, we just handle them in the unity side code, but i'd like to get the incident report also so i don't need to make a fake exception as i have the real one already. i could then just do like MetaplaySDK.IncidentTracker.Report**Handled**Exception(ex) 🙂
j
Yeah that works, UnhandledExceptionReport just has strings for the message/stacktrace, so you cna also just create one manually and report it using the same mecanisms
a
right-o, i was guessing that maybe it's so
I'm actually adding this to the IncidentTracker so it's slightly less confusing 🙂 public void ReportHandledException(Exception ex) { //this piggybacks DoReportUnhandledException in a bit hackish way string exceptionMessage = $"Handled Exception Message: {ex.Message}"; DoReportUnhandledException(exceptionMessage, stackTrace: ex.StackTrace, _logHistoryTracker.GetLogHistory()); }
j
Yep that works. I'd recommend making it an extension method though so you don't have to deal with manually updating that, next time you update the SDK
a
hm yes or maybe i just put it to some own logging class. or consider making some custom incidents regarding these for the longer run. thanks a lot for the info and suggestions!