- Home /
Question by
MrKoor54 · Mar 05, 2014 at 01:47 PM ·
menupausepause menu
Game stopping at Pause?
Hello, I was wondering how I could get the player to stop moving and the game to stop when the pause menu is opened (via esc) then resumed after the esc key is pressed.
Yes I have looked through google and I've looked for hours...
void Start()
{
this.currentMenuComponent = MainMenuComponent;
}
void Update()
{
if (Input.GetKeyDown (KeyCode.Escape))
{
if (showGUI == false)
{
showGUI = true;
return;
}
if (showGUI == true)
{
showGUI = false;
this.currentMenuComponent = MainMenuComponent;
return;
}
}
}
Comment
Answer by whydoidoit · Mar 05, 2014 at 01:47 PM
Set Time.timeScale to 0 and presuming you are using Time.deltaTime things will stop moving and animations will also stop.