Application.CommitSuicide?

Hi, i was typing up a script when I came along Application.CommitSuicide. I’ve tried looking into what it is but I can’t find anything about it. Does anybody know what it’s for? Thanks.

Quick answer: Application.CommitSuice(1); causes a message telling the user that an intentional error has occurred (such as if unity crashed, etc). The Report Error window then pops up, and Unity crashes. You can simply restart Unity afterwards (hopefully you save beforehand!).

I am not familiar with the int modes you can put in the parenthesis.

This is a simple answer for anyone in the future reading.

Two things about that function:

  1. It’s not documented. That’s a general sign that you shouldn’t use it at all.
  2. It’s marked with Obsolete("For internal use only"). So it’s even more clear that you shouldn’t use it and that you actually shouldn’t be able to use it since it’s only ment for internal use.

What it actually does, doesn’t matter. It might simply exit the editor / application with an error code (by using ExitProcess or TerminateProcess on windows machines). If you really want to know what happens, try it.

It would be useful for doing a license check on your game. If you find that someone pirated the game, you would save that and instantly close the game whenever its opened.