- Home /
Question by
KingKongFu · Nov 16, 2012 at 05:25 PM ·
booleanpausecontrol
Pasue Game and then Ask for input to unpasue
Hello what im trying to do is pause the game and then ask for input to un-pause it basically. I have worked this out to a degree but now it give a fatal error and kills the game. So this is my ongui function to display the input needed
function OnGUI()
{
var m : int;
m = meters;
GUI.Box(new Rect(0,0,Screen.width/4,Screen.height/5), "Jump ");
GUILayout.Label("");
GUILayout.Label("Alt: " + m + "m");
while(sliderGUI == true)
{
GUI.Box(new Rect(0,0,Screen.width/4,Screen.height/5), "");
GUILayout.Label("");
GUILayout.Label("");
GUILayout.Label("Chosices");
GUILayout.Label("Error: ");
GUILayout.Label("");
GUILayout.Label("Press A to do something");
GUILayout.Label("");
GUILayout.Label("Press X Hope for the best");
if(Input.GetKeyDown(KeyCode.A))
{
sliderGUI = false;
pause = false;
}else
{
pause = true;
}
if(pause == true)
{
//pause game
Time.timeScale = 0;
}else
{
//resume game
Time.timeScale = 1;
}
}
}
And then this is where I call this function somewhat by makeing the sliderGUI boolean true.
function SliderHangup()
{
this.animation.CrossFade("SliderHang");
this.rigidbody.drag = 0.9f;
Debug.Log("Animation time " + this.animation.clip.length);
yield WaitForSeconds(2);
sliderGUI = true;
}
Comment
Your answer
Follow this Question
Related Questions
How to make camera position relative to a specific target. 1 Answer
Xbox 360 Control GUI problem 0 Answers
Creation of a Pause and a Console Menu? 2 Answers
Hold the esc button for a pause menu 1 Answer
Waiting for a Function to Complete 1 Answer