- Home /
Question by
meadseu · Oct 08, 2016 at 04:05 PM ·
unity 5updatepausefixedupdate
Noob question. Game is pausing using Update but not on FixedUpdate?
public class PauseMenu : MonoBehaviour {
public bool isPaused;
public string sceneName;
public GameObject pauseMenuCanvas;
void FixedUpdate ()
{
if (isPaused)
{
pauseMenuCanvas.SetActive (true);
Time.timeScale = 0f;
}
else
{
pauseMenuCanvas.SetActive (false);
Time.timeScale = 1f;
}
}
public void Resume(AudioSource sources)
{
sources.Play ();
isPaused = false;
}
public void MenuScreen(AudioSource sources)
{
sources.Play ();
isPaused = false;
}
public void Quit(AudioSource sources)
{
sources.Play ();
isPaused = false;
}
public void TriggerPause()
{
isPaused = !isPaused;
}
Comment
Your answer
Follow this Question
Related Questions
Time.timeScale seems doesn't work with Update 1 Answer
Update/FixedUpdate motion stutter (Note: This is NOT a novice deltaTime question) 16 Answers
Multitouch in update or fixedupdate 0 Answers
What's FixedUpdate 2 Answers
Why is OnGUI called significantly more than Update and FixedUpdate? 4 Answers