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 :/
![alt text][1]
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;
}
}
[1]: /storage/temp/37837-screen+shot+2014-12-30+at+3.41.28+pm.png
↧