check Player setting => Resolution => (Run In Background) 


OnApplicationPause/OnApplicationFocus has been all over the place for me. In the Editor, it seems to be different on PC and MAC. On MAC it seems to get called on press Play. On PC it doesn't. On iOS it seems like one of them doesn't work. Can somebody tell me the different scenarios that they work?

And can somebody explain what they mean in each scenario? Editor? Standalone? iOS? Android? (like does OnApplicationFocus fire when you minimize or when you just click on another window in the Editor)

I know about the documentation, I read the documentation. But the behavior doesn't match it. It's ridiculous. If somebody has figured it out I'd greatly appreciate it.






Since this UnityAnswer is one of the first (if not the first) to be returned on a search for OnApplicationFocus/Pause & iOS, an important update in Unity 4.6.1 has changed the behavior for iOS.

As of 4.6.1, both OnApplicationFocus and OnApplicationPause will be called in iOS.

The order is :

App initially starts:

  • OnApplicationFocus(true) is called

App is soft closed:

  • OnApplicationFocus(false) is called

  • OnApplicationPause(true) is called

App is brought forward after soft closing:

  • OnApplicationPause(false) is called

  • OnApplicationFocus(true) is called

Hope that helps




http://answers.unity3d.com/questions/496290/can-somebody-explain-the-onapplicationpausefocus-s.html

반응형

+ Recent posts