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;
        }
    }
}

Set Time.timeScale to 0 and presuming you are using Time.deltaTime things will stop moving and animations will also stop.