Ignore GetKeyDown when Time.timeScale = 0

I am trying to make a pause menu where, when i press pause, it ignore my keyboard input till i press resume again.

void Update()
	{
		if(Input.GetKeyDown(KeyCode.Alpha1))
		{
			CheckForCard(1);
		}
		if(Input.GetKeyDown(KeyCode.Alpha2))
		{
			CheckForCard(2);
		}
		if(Input.GetKeyDown(KeyCode.Alpha3))
		{
			CheckForCard(3);
		}
		if(Input.GetKeyDown(KeyCode.Alpha4))
		{
			CheckForCard(4);
		}
		if(Input.GetKeyDown(KeyCode.Alpha5))
		{
			CheckForCard(5);
		}
		if(Input.GetKeyDown(KeyCode.Alpha6))
		{
			CheckForCard(6);
		}
		if(Input.GetKeyDown(KeyCode.Alpha7))
		{
			CheckForCard(7);
		}
		if(Input.GetKeyDown(KeyCode.Alpha8))
		{
			CheckForCard(8);
		}
		if(Input.GetKeyDown(KeyCode.Alpha9))
		{
			CheckForCard(9);
		}
	}	

I get my input in update and i put my pause menu in another script

public void OnPause()
	{
		pausePanel.SetActive (true);
		pauseButton.SetActive (true);
		Time.timeScale=0;
	}

	public void OnUnPause()
	{
		pausePanel.SetActive (false);
		pauseButton.SetActive (false);
		Time.timeScale=1;
	}

My problem now is when i pause, it still records because its in the Update() and i can’t really do with getAxis and getKey. Thanks in advance :smiley:

Exit Update if Time.timeScale is 0?

void Update()
{
    if (Time.timeScale == 0)
        return; 

    if (Input.GetKeyDown(KeyCode.Alpha1))
    {
        CheckForCard(1);
    }
    if (Input.GetKeyDown(KeyCode.Alpha2))
    {
        CheckForCard(2);
    }
    if (Input.GetKeyDown(KeyCode.Alpha3))
    {
        CheckForCard(3);
    }
    if (Input.GetKeyDown(KeyCode.Alpha4))
    {
        CheckForCard(4);
    }
    if (Input.GetKeyDown(KeyCode.Alpha5))
    {
        CheckForCard(5);
    }
    if (Input.GetKeyDown(KeyCode.Alpha6))
    {
        CheckForCard(6);
    }
    if (Input.GetKeyDown(KeyCode.Alpha7))
    {
        CheckForCard(7);
    }
    if (Input.GetKeyDown(KeyCode.Alpha8))
    {
        CheckForCard(8);
    }
    if (Input.GetKeyDown(KeyCode.Alpha9))
    {
        CheckForCard(9);
    }
}

Or, create a wrapper input class which checks Time.timeScale first.

public static class PausableInput
{
    public static bool IsPaused { get { return Time.timeScale == 0; } }

    public static bool GetKeyDown(KeyCode key)
    {
        return IsPaused ? false : Input.GetKeyDown(key);
    }

    public static bool GetKeyUp(KeyCode key)
    {
        return IsPaused ? false : Input.GetKeyUp(key);
    }

    public static bool GetKey(KeyCode key)
    {
        return IsPaused ? false : Input.GetKey(key);
    }
}