Hi! I am developing a game for PC/Mac, I’m scripting using C#, working on a Mac as my development machine.
I would like to know if it is possible to detect when a standalone application crashes unexpectedly so that I can trigger a reaction accordingly (most likely save the output log and e-mail it to us (game developers)).
This is similar (if not the same) to the windows Error Reporting service or Unity’s own “Report Bug” tool.
I tried to search for “termination”, “crash” and “report” but couldn’t find anything related. OnApplicationQuit seems to only work for when the quit process is initiated by the user, if i understand the script reference document correctly.
Please advise, and thank you in advance!
Hi, welcome to the forum!
One way to do this might be to save something to player prefs when the game starts up and then remove it again when it quits. If a crash terminates the game, the data will not be removed. On the next launch, you can look for this data and send a bug report if it is present.
Hi! Thanks for the tip! Sounds like a great idea! Though our design would prefer it to appear after a game crashes. I’ll reason with the design dept and give it a go.
Seems like the output_log.txt file is cleared when you relaunch a new game… so any helpful data from the crash is also cleared.
That’s unfortunate… any other suggestions/workarounds?
I am also interested in resolution to the same issue except that my game is web-based, not stand-alone.
there is no workaround.
you need the log that was there on crash and store it. if its lost then its just like that, nothing to do about it I fear.
the webplayer never uses the same log twice and logs from crash sessions remain in the log folder (see docs to find it)