I am making my game as webgl. I do not keep the time constant by doing it with the timer script, I want the game time to continue to flow while in the background. I do this with OnApplicationPause, it works on android but not on ios or other systems. I tried to enable background run, it still gives problem on ios, I don’t know how to fix it.
void OnApplicationPause(bool isGamePause)
{
Debug.Log(“OnApplicationPause içerisindeyim.”);
if (isGamePause)// oyun pasif iken
{
if (!isGameActive)
{
isGameActive = true;
pauseStartTime = DateTime.Now; // Pasif durumun başladığı anın zamanını al
Debug.Log("İsGamePause içerisindeyim.");
}
}
else {
// Oyun tekrar aktif duruma geçtiğinde (uygulama devam ediyor)
if (isGameActive)//gerek yok gibi isGameActive Kontrol edilcek.
{
DateTime resumeTime = DateTime.Now;
pausedDuration = (resumeTime - pauseStartTime).Seconds;
isGameActive = false;
isSecondTakeTime = true;
Debug.Log("OnApplicationPause Else içerisindeyim.");
}
}
}