Hello everyone!
I’ve made a script, witch checks if the touchpad is touched and stops time, setting the variable paused = true, hiding the HUD(including the touchpad) and displaying the GUI.Button. The problem is: after the touchpad(named lePauseButton) is touched IT DOESN’T DISPLAY THE BUTTON.
Here’s the script:
var lePauseButton : Joystick;
lePauseButton.active = true;
var paused : boolean = false;
var resumeButton : Texture2D;
var hud : GameObject;
hud.active = true;
function Update () {
if (lePauseButton.IsFingerDown() && !paused){
print("Paused");
Time.timeScale = 0.0;
paused = true;
hud.active = false;
lePauseButton.active = false;
}
} //it's like the script from now on doesn't even exist.
function OnGUI () {
if(paused){
if(GUI.Button (Rect (Screen.width/2 - 100, Screen.height/2 - 200, 200, 100), resumeButton)){
print ("Unpaused");
Time.timeScale = 1.0;
paused = false;
lePauseButton.active = true;
hud.active = true;
}
}
}
That’s pretty much it, I’ve spent over 5 hours on studying the sctipt, raped the google for answer but i couldn’t find a thing.
Help will be much appreciated.
Take Care!