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.
Use this function OnApplicationPause
private void OnApplicationPause (bool paused)
{
if (paused)
StopClock();
else
EnableClock();
}