Is there any way to find out when an application is on focus?

Hi,

Is there any way to find out when an application is on focus? For example when I switch to another application and want to come back to my unity application, Is there anything like "Application.OnFocus" ?

Thanks in advance .

In Unity 2.6 you can't (unless you write a C++ plugin).

Unity 3.0 adds this functionality as OnApplicationPause() and OnApplicationFocus() callbacks.

There is:

// Make the game run even when in background

Application.runInBackground = true;

which can be found from script reference Link