Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void OnEnable() {
- Application.logMessageReceived += OnLogException;
- }
- void OnDisable() {
- Application.logMessageReceived -= OnLogException;
- }
- static private void OnLogException(string _message, string _stackTrace, LogType _logType) {
- if (_logType == LogType.Exception) {
- if (Application.isEditor) {
- // Only break in editor to allow examination of the current scene state.
- Debug.Break();
- } else {
- // There's no standard way to return an error code to the OS,
- // so just quit regularly.
- File.WriteAllText("traceback.txt", _stackTrace);
- Application.Quit();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement