Detect iphone switching appliction.

Hey all.

I want to detect if the user on the Iphone switches from my game to other application (Multitasking). This way when the user comes back to the game i can pause the game.

I need something to detected that the user has switched from game to other application and back to the game.

If you want to support multitasking, you're going to have to do it with a native plugin.

http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/CoreApplication/CoreApplication.html#//apple_ref/doc/uid/TP40007072-CH3-SW1

It's mostly going to be handled on the Objective-C side, and you can do things like use UnitySendMessage to send a message to a specific game object telling you about the application switching.

There should be a MonoBehaviour event which is called when it happens

I think it's OnApplicationPause

Check the MonoBehaviour docs in the Script Reference (the local one on your hard drive for iphone), it should have it in there, as well as the one for when it's unpaused