- Home /
The question is answered, right answer was accepted
Deliberately Forcing the Game to Crash
Due to a certain plot point in a platformer I'm working on, one character is "too awesome", so the game is planned to save and then crash when the player first approaches him the first time and only the first time.
But I'm stumped on how to force a crash that would do so on all computers without possibly damaging their system. Actually, I'm stuck on how to make the game crash in general. How would I go about this?
I'm new to unity but isn't there a application.quit? Could you not just set a variable to record if this encounter has happened before and change it to true before quiting the application?
if (//Condition(walk up to super awesome dude) && encounter == false) { encounter = true;
application.quit (or somthing like this) }
Well, yes, but that doesn't quite have the required effect.
Answer by BiG · Jan 16, 2012 at 03:54 PM
I don't think that's possible in a "safe" way - however, a "crash" is, by definition, an unwanted behaviour of an application: this implies that's impossible to "planning" it. Even if you hack the memory consuming (that's very not reccomended!), you can 't be sure to obtain the same behaviour on different machines, or if your game will be played 5-6 years after its creation, on more powerful machines.
For your purpose, I will acting in a different way (maybe less "stunning" for the final user): save the game, pop up a text like "This character is too awesome! Your game will be closed in a moment, 'cause it cannot handle that...) - or something similar -, wait for some seconds with a "yield WaitForSeconds()", to allow the player to read that, and then close the application with "Application.Quit()".
EDIT (another idea): Sorry for re-open that, already closed, question. But I've just had another idea, and maybe you could be interested. Take a snapshot of a Windows error popup, and make it as a texture. "Paste" it onto a plane, and make a new scene in which you visualize that plane. You have just made a fake error popup. When you encounter that character, save the game, unload the actual scene, and load the scene that I've just explained! Then, if the player click in proximity of the "OK" button, you will close the application with Application.Quit(). Pay attention, you also have to adapt the resolution of the application at run time (look here), to make a credible popup. It's just a Photoshop trick and, obviously, a Mac standalone would be a little out of place in the end, with a Windows error! ;)
Understood. Oh well...
Your idea makes sense, and I think I may know how to make it look more realistic and restore the general effect. First off, I could put a translucent white filter over the screen to replicate what happens in Windows when something crashes, and then make a load of pop-ups appear all over the screen saying messages such as "Overloaded with awesomeness, unable to properly run.", and then the program closes.
While I think the crash then pop-up idea is quite interesting, I'd avoid throwing many of them as it does re$$anonymous$$d me of the behaviour old crappy websites did a few years ago. Having to click many/click faster than pop-ups was really unappreciated. Just stick to one and I believe user response will be better - just my two cents! :D
@burnpsy, you could also be interested in another approach, a little more tricky. Just look at the edit in my original answer.
I like that idea as well. The general idea is the same, though. Rather than making it crash, I just make it look like it crashed.