- Home /
Mobile - Detect when game isnt the focus
I am creating a game for mobile sort of like Clash Of Clans and I'm working on an internal clock (that runs separate of the phone clock, to prevent cheating) and it runs off of the deltaTime. Which isn't calculated when the game isn't in "focus" on a device. So when the game is taken out of focus or "minimized" I would like the game to restart when brought back up so that the internal clock reset to our server time. Is there a way to do this? I can give more information if needed.
Answer by Crazydadz · Mar 27, 2014 at 06:50 PM
Use this function OnApplicationPause
private void OnApplicationPause (bool paused)
{
if (paused)
StopClock();
else
EnableClock();
}
Thank you very much, and for the fast response. This worked perfectly.
Your answer
Follow this Question
Related Questions
VSync + minimized game uncaps the framerate 1 Answer
How to script a seconds hand of a clock 1 Answer
Programming Accurate Clock Hands 1 Answer
Minimize MacOSX fullscreen and open URL 1 Answer
Issue with Maximize and Minimize 0 Answers