Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
4
Question by Herman-Tulleken · Jan 19, 2011 at 12:30 PM · mobilepausecallbackresumeonapplicationpause

Does OnApplicationPause actually work?

There are lots of answers suggesting using OnApplicationPause for doing stuff when the application goes out of focus (for instance, when the Home button on the iPhone is pushed).

We don't see that this function is called.

Does this in fact work, or do you need magic to make it so? If not, why does so many answers suggest it, and how do those answer get accepted?

Edit: And why is none of this in the documentation, Unity guys?

Edit: We need a solution for iPhone (and Android).

More info: The OnApplicationPause does get called for PC (with RunInBackground switched off), and on iPhone when we put it in the class that directly extends from Monobehaviour (in our system, called DebuggableManobehaviour), but not in any classes that extend from DebuggableManobehaviour (which is all the game classes in our project).

TIA

ht

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 el_ewok · May 22, 2012 at 07:04 AM 1
Share

Hi Herman,

Did you fix this issue??? I have the same problem, my application still running in background when is interrupt with lock or home button.

I'll really apreciate if you can tell me what you did to solve this problem and pause calling OnApplicationPause method.

Thanks.

avatar image Bonfire-Boy · May 26, 2015 at 04:00 PM 0
Share

Have you made OnApplicationPause() virtual in Debuggable$$anonymous$$anobehaviour and used the override keyword when overriding it in the subclass?

3 Replies

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

Answer by jonas-echterhoff · Jan 19, 2011 at 02:26 PM

If the player is paused, OnApplicationPause should be called. If it isn't, that's a bug, you should file it. Is your player actually pausing? Maybe you have the run in Background checkbox enabled?

Comment
Add comment · Show 2 · 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 Herman-Tulleken · Jan 19, 2011 at 02:42 PM 0
Share

Thanks, Jonas. I only see the option for Windows and Web player. Is it at all available for iPhone? We can see that the UnityPause (AppController.mm) function is called in from the Unity-generated XCode, but for some reason the OnApplicationPause does not reach our application.

avatar image Herman-Tulleken · Jan 19, 2011 at 03:15 PM 0
Share

Jonas, we have narrowed the issue down (see my updated question), so you are right, this is a nasty little bug, at least one with a workaround, however annoying it is. We will file a bug report. Thanks for the "run in background" info (it would be handy if that could be in the docs under the OnApplicationPaused description...)

avatar image
0

Answer by shinriyo_twitter · Feb 08, 2013 at 09:13 AM

Edit: We need a solution for iPhone (and Android).

iPhone can work. but iPod doesn't work well.. Android doesn't support. you must create plugin

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 nicloay · May 26, 2015 at 01:24 PM

It works on iOs, but doesn't on android. I have heavy task finished before app goes to bg(take screenshot and store to the local drive) and i see that this job is paused when app goes to background and finished only when you come back. so if you close the app while it is in background it won't be finished.

upd1: Actualy method called on android as well, the problem is that it doesn't wait until the method is done, even if you make it as coroutine. and it's a problem for me. I need to make serialization, and the method complete only when you focus your app back.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Android - Mute button not working when returning from home screen 1 Answer

Fitbit CallbackURL 2 Answers

My Unity Android app is preventing the lock screen from displaying properly 2 Answers

Unpausing While Keeping Values 0 Answers

pause,resume and save coroutines 2 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