This question was
closed Apr 07, 2016 at 10:45 AM by
meat5000 for the following reason:
The question is answered, right answer was accepted
Question by
niazniz · Apr 07, 2016 at 12:53 AM ·
unity 5unityeditorunity 4.6pause menuerrormessage
this is my pause menu script but it doesn't pause my game or neither the pause menu disappear however restart works fine
using UnityEngine; using System.Collections;
public class PauseMenu : MonoBehaviour {
public GameObject PauseUI;
private bool paused = false;
void start()
{
PauseUI.SetActive (false);
}
void update()
{
if(Input.GetButtonDown("Pause"))
{
paused = !paused;
}
if(paused)
{
PauseUI.SetActive (true);
Time.timeScale = 0;
}
if(!paused)
{
PauseUI.SetActive (false);
Time.timeScale = 1;
}
}
public void Resume ()
{
paused = false;
}
public void Restart ()
{
Application.LoadLevel (Application.loadedLevel);
}
public void Quit ()
{
Application.Quit ();
}
public void MainMenu ()
{
Application.LoadLevel (0);
}
}
Comment
Best Answer
Answer by gjf · Apr 06, 2016 at 10:42 PM
are you expecting unity to call start()
or update()
? it won't.
Start()
and Update()
on the other hand...
gjf - YOU ARE GENIUS THAN$$anonymous$$SSSSSSSSS A LOTTTT IT works now - my silly mistake but thanks again