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).



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?

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

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.