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 d112570 · Jun 01, 2015 at 05:42 PM · quitexit

Unity 5 - ExitApplication(); causes Crash

Is Unity 5 not compatible with this code?

 ExitApplication();

When launched within Editor or game app, both crash.

2 other ways I found that also quits the app are;

 Application.Quit();

and

 if (!Application.isEditor) System.Diagnostics.Process.GetCurrentProcess().Kill();

What is the difference between Exit and Quit?

Comment
Add comment · Show 5
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 valyard · Jun 01, 2015 at 06:01 PM 0
Share

What is ExitApplication exactly?

avatar image d112570 · Jun 01, 2015 at 06:31 PM 0
Share

It Exits the application, code seems not to work anymore.

avatar image valyard · Jun 01, 2015 at 06:41 PM 0
Share

Where is this function from? Unity API doesn't have it.

avatar image d112570 · Jun 02, 2015 at 07:46 AM 0
Share

I got the code from here, it was an answer where no one had problems with. Apparently it does have a Unity API since no one complained and also had thumbs up.

http://answers.unity3d.com/questions/780359/button-on-click.html

avatar image SNS_Case d112570 · Nov 03, 2015 at 09:39 PM 0
Share

You probably shouldn't argue whether something is in the API if you don't know what you're doing in the first place. It crashes because the sample function provided in the answer you referenced calls itself infinitely and does nothing else. That answer wasn't aimed at how to quit the application, but how to handle button OnClick events. Granted, I guess it technically does close the app eventually.

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Xarbrough · Nov 03, 2015 at 11:44 PM

The correct way to exit a Unity application is

 Application.Quit()

Scripting Api

Your third option using .NET is not what you want. Kill() is like opening Task Manager and killing a frozen process. You need to go the Unity built-in route, so that it cleanly exits and frees up memory.

Comment
Add comment · Show 1 · 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 plbyrd · Feb 10, 2017 at 05:45 PM 0
Share

I'm using Application.Quit() and the game still crashes.

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

25 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

Related Questions

How to end a game with ESC button. 1 Answer

How to Exit Application in Android on Back Button 3 Answers

"Application" word in code not recognized. 1 Answer

onExit, onQuit, or anything like that? 2 Answers

Make a button quit the game, Unity 4.6 UI C# 1 Answer


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