- Home /
How to throw a fatal error
I'm curious if there is any way to throw a fatal error myself, without forcing the application into it. Something where I could supply my own text for the error dialog and close the application. Or, To make it simpler, all I'm wanting to do is show any sort of dialog when I close my application.
Did you ever find a good way to do this? I'm thinking of creating a separate "Fatal Error" scene that gets loaded and displays the error, but I'm not sure how feasible it is to try to shut everything else in the game down. You'd need to grab all the "dont unload" stuff and destroy it explicitly, or at least SetActive(false) the GameObjects.
Answer by ardaozkal · Sep 15, 2014 at 11:27 PM
Make a button and a guitext. Set guitext inside your code and when user presses the button do Application.Quit
I'm not looking for an in game dialog. I'm quite overly familiar with GUI and GUILayout. I'm looking for a way to display a system dialog specifically. The easiest way I could think about doing this was throwing an error with my own message content.
Since Unity is multiplatform, it tries to avoid using those dialogs when possible, ins$$anonymous$$d pushing output to it's own internal log system.