Is there a way to make Unity continue rendering when the Fast App Switcher is open?

I am working on a puzzle game for iOS but my users have found a fun exploit: If you open the fast app switcher (double-tap Home button), the Pause menu doesn’t appear and they can see most of the puzzle without the time ticking down.

I have already tapped into the OnApplicationPause() event to call the Pause window, but it doesn’t appear until the user taps on the game screen to close the Fast App Switcher. At first I thought it was an animation problem or something, but it seems unity doesn’t draw the next frame until the application becomes active again. (I tried doing an instant colour change instead of an animation, but got the same result)

9948-img_0405.png

I’ve checked other apps, such as Bejeweled, and they hide the puzzle with an animation while the switcher is open, which suggests that the app view can still be drawn to. (I realise that Bejeweled is probably not made in Unity; the point is that the view isn’t frozen by iOS)

Does anyone know if there is perhaps a setting to make Unity continue drawing while the view is open, or have any other ideas? All I can think of is making a view in native, but thats going to be annoying for many reasons…

1 Answer

1

I solved this by using a category to override the applicationDidEnterBackground, applicationWillEnterForeground, applicationDidBecomeActive, and applicationWillResignActive selectors in the AppController in XCode, and passed them all to unity via UnitySendMessage, and implemented a listener in C# that triggers Actions when it gets each message. I also added an option to allow unity to control pausing (but not unpausing, since unity won’t process the message until the next frame, which it won’t do if paused)

Its not the most elegant solution, but it works. Might make porting a little annoying, but for the time being I wrapped the SendMessage events in #ifdefs so non-iOS will trigger the events via the standard OnApplicationPause.

Seems odd that theres no option for this though…

Also see http://answers.unity3d.com/questions/387816/render-1-more-frame-after-onapplicationpause-on-io.html