Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whats the difference between OnApplicationFocus() and OnApplicationPause()?

Speaking of mobile devices, whats the difference between those two methods? If I press the home key both are called. Is there any situation when one is called and not the other?

like image 201
Chorche Avatar asked Jul 22 '15 09:07

Chorche


1 Answers

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.unity.com/answers/970958/view.html

like image 98
Hemanth chalamalasetti Avatar answered Dec 15 '22 09:12

Hemanth chalamalasetti