Search Unity

UnPause a game on windows simulator devices.[Solved]

Discussion in 'Scripting' started by tmanallen, Dec 18, 2014.

  1. tmanallen

    tmanallen

    Joined:
    Nov 8, 2009
    Posts:
    395
    Hello everyone,
    I have run into bit of an issue with unpausing a game on the windows simulator, no actual device and don't know what difference that would really make, but it works in unity Editor, so my pause code and resume are something like this.

    Code (CSharp):
    1.  //layout start
    2.             GUI.BeginGroup(new Rect(Screen.width / 2 - 150, 50, 300, 500));
    3.  
    4.             //the menu background box
    5.             GUI.Box(new Rect(0, 0, 1200, 1200), "");
    6.  
    7.             //logo picture
    8.             GUI.Label(new Rect(80, 10, 300, 125), logoTexture);
    9.  
    10.             GUILayout.Space(30);
    11.             GUILayout.Label("Volume");
    12.             AudioListener.volume = GUILayout.HorizontalSlider(AudioListener.volume, 0, 1);
    13.             ///////pause menu buttons
    14.             //game resume button
    15.  
    16.             if (GUI.Button(new Rect(55, 250, 180, 40), "Resume"))
    17.             {
    18.                 //resume the game
    19.                 Time.timeScale = 1.0f;
    20.                 Updates.GamePaused = false;
    21.                 AudioListener.pause = false;
    22.             }
    23.        
    24.  
    25.             //quit button
    26.             if (GUI.Button(new Rect(55, 350, 180, 40), "Quit"))
    27.             {
    28.                 Application.Quit();
    29.             }
    30.  
    31.             //layout end
    32.             GUI.EndGroup();
    As you can see when I hit unPause the Time scale goes back one but it also works in the editor and not on the simulator, any advice?
     
    Last edited: Dec 18, 2014
  2. tmanallen

    tmanallen

    Joined:
    Nov 8, 2009
    Posts:
    395
    Just for everyone to know, it worked itself out, I don't know how or why but it works great now after I restarted my pc.