Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by risinghell09 · Jul 12, 2014 at 09:21 PM · javascriptapplication

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.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Lo0NuhtiK · Jul 12, 2014 at 09:26 PM 2
Share

http://forum.unity3d.com/threads/application-commitsuicide-int-mode.46495/

Edit : I'm bored, and saw this topic is still on the front page of the questions list, so I guess I'll add my two cents to go along with the info from that old forum topic without bumping it...

Rules of Application.CommitSuicide() :

Application.CommitSuicide(int mode) summons $$anonymous$$ira, the Shinigami that Light Yagami became after his demise.

The (int mode) is actually an optional parameter since Application.CommitSuicide() is the original function.

If you don't pass the int parameter, you'll simply die from a heart attack within 40 seconds after calling the function.

If you do pass the int parameter, different numbers mean different things. From 0-9, these are 9 different ways to die (undocumented, and no survivors to tell us what kind of death the numbers decided; but rumor has it that zero will be a heart attack just like without passing an int, and that one of the other numbers has $$anonymous$$ira write up an interesting way for you to kill yourself which screws up the whole deal and is quite possibly a far worse way to die; but it'll still be easier to kill yourself this way since you're being compelled by a supernatural force to do so).

For three digits AFTER the first digit, any number between 0-365 will indicate the number of days to pass after calling the function before you die. If you pass any three-digit number greater than 365, it will indicate that you want it to be randomized 0-366 (exclusive of max). One year is the longest time you can set, so if you want to wait longer then you need to use a coroutine that will call Application.CommitSuicide() after a certain amount of time. (Personally, I think if you're going to wait any longer than maybe until the next holiday or your wedding anniversary or something, then you might as well just hold off on calling this function altogether because you might change your $$anonymous$$d at some point.)

Entering a zero or a one after the three-digit day will decide a day/night-time death (if you only want to enter a single or double-digit day, then do it as 001 or 021, etc; left-pad with zero's), any single digit entered here that is greater than 1 will result in a random choice between day/night.

avatar image Razacx · Jul 12, 2014 at 11:57 PM 0
Share

omg that death note reference xD

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Firedan1176 · Jul 13, 2014 at 12:18 AM

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Bunny83 · Jul 12, 2014 at 11:39 PM

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by revapps · Jul 13, 2014 at 12:55 AM

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

26 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Walking animation problem. 0 Answers

Problems with java script. 1 Answer

How to have animation play correctly 1 Answer

Calling a C# function from a Javascript 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges