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 rsud · Jul 27, 2012 at 09:46 PM · iosappexit

iPhone exits app when game ends?

I see posts that say that you can't exit on the iPhone and that the 'home' button does it.

But with the iPhone now doing multitasking the home button doesn't exit the game. How do I end (terminate) the game when the game is over?

Currently when one loses my game I play an end animation with repeating music. If the 'home' button is hit you back to the iOS. But if you tap the game icon you are back at the end animation and music of my game. 2 days later and tapping the game icon returns to the end of game animation and music.

One can force close the by double click of 'home' button and then tapping and holding the game icon until the '-' sign next to the running game appears. But this isn't really what is good or convenient for the user.

I want the player to be able to return to the game after the 'home' button is hit while the game is going on. But when the game is complete and after my end-game animation sequence I want to exit the game so the player can restart.

How can this be done?

Comment
Add comment · Show 7
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 Seth-Bergman · Jul 27, 2012 at 09:50 PM 0
Share

It's my understanding that iOS does not allow for this, their apps just keep running in the background until it needs the memory for something else.. You should build in a reset function for going back to the start menu after end animation/music

avatar image rsud · Jul 27, 2012 at 09:53 PM 0
Share

Is it possible to get Unity to restart the game?

avatar image Seth-Bergman · Jul 27, 2012 at 10:01 PM 0
Share

in Android, you can quit.. But I don't think iOS gives the option, at least that's my understanding.. But just do something like this in a script on your final scene:

function Update(){

if(!movie.isPlaying() && !audio.isPlaying())

Application.LoadLevel(0);// title screen scene

}

I may be wrong, but this is just what I've heard

avatar image Seth-Bergman · Jul 28, 2012 at 12:33 AM 0
Share

an interesting "suggestion" here:

http://gamedev.stackexchange.com/questions/17709/can-an-ios-application-have-an-explicit-quit-button

someone recommends intentionally crashing the app with a line of bad code, to the user it just seems to close :D

avatar image Eric5h5 · Jul 28, 2012 at 12:36 AM 0
Share

Why don't you just have a button the player can tap that restarts the game? It's pretty weird that you'd want to make the player exit the game just to restart.

Show more comments

1 Reply

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

Answer by Fattie · Jul 28, 2012 at 12:30 PM

it's surprising lot's of iOS programmers didn't quickly yell this answer at you!!

alt text

click build then player settings .. that's your answer! it's that simple.

You can read about this extensively..

eg, http://devgirl.org/2011/06/24/exit-vs-suspend-your-ios-application/

or at Apple, long URL at Apple's docu...

scroll down to "UIApplicationExitsOnSuspend key in its Info.plist"

Note that:

"I want the player to be able to return to the game after the 'home' button is hit while the game is going on. But when the game is complete and after my end-game animation sequence I want to exit the game so the player can restart."

in the iPhone universe, all of that is not possible.

(1) you cannot quit iFone apps from within the app. the user can only quit them using the plastic round button. this is an extremely basic aspect of iFone apps: as a developer, you simply cannot exit iFone apps, it's that simple. give that there are now, what 1/2 million iFone apps and 88 gazillion ifones this is well-understood and established! I guess anyone with an ifone (pad, pod, etc) understands that you cant quite an ifone app from within the app. (if you use the ridiculous trick of crashing the app, apple will simply reject it of course, if they catch the trick, or, they'll just instantly pull it from the store if someone notices later.)

(2) regarding the player returning after going to another app and playing on, that is fairly automatically handled by Unity, read the long URL above for full gory and annoying details!!


suspend.jpg (22.3 kB)
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 rsud · Aug 10, 2012 at 01:47 PM 0
Share

Thxs for this info!

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

9 People are following this question.

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

Related Questions

bad quality icon on iOS 1 Answer

Question reguarding testing my IOS build in Xcode 0 Answers

iOS App Store Size 1 Answer

Veeery small iOS app 1 Answer

Sound Recorder app in Unity for IOS 0 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