On OS 4.0+, the OnApplicationPause method gets called when the user hits the home button. When the game is launched again, the last frame holds for a second or two before the game resumes and the code is run. Is there a way to run code on the last frame before the pause? Similar to how OnApplicationQuit() executes before the application closes.
Here’s a video demonstrating the problem. When I quit the app, it freezes the last frame. On resume, it shows that frame for about a second before executing the pause code.
void OnApplicationPause()
{
GameObject.Instantiate(loadScreen);
}