- Home /
UI button behaves wrong on iPad
Pause button pauses the game OK, but if I press it again to resume it loads the main menu (the first scene); suspecting that the Time.timeScale is the cause but don't know. all the bindings are set correctly and it works perfect on desktop :/
this is the TogglePause():
public void TogglePause()
{
//if the game is paused - resume, this part is bugging :/
if (gameState == (int)GameState.Paused)
{
adBound = false;
XCodeBinding.AdFooterLoad (adBound);
Time.timeScale = 1f;
if (prePauseState != GameState.Starting)
{
gameEngine.audio.Play();
}
PlayerPrefs.SetInt("GameState", (int)prePauseState);
gameEngine.audio.volume = 1f;
fadeOutTimer = 0f;
}
//if the game is not paused - pause
else
{
adBound = true;
XCodeBinding.AdFooterLoad (adBound);
Time.timeScale = 0f;
//Debug.Log(gameEngine);
gameEngine.audio.Pause();
prePauseState = (GameState)PlayerPrefs.GetInt("GameState");
PlayerPrefs.SetInt("GameState", (int)GameState.Paused);
fadeOutTimer = -0.01f;
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613175203im_/https://answers.unity.com/themes/thub/images/avi.jpg)