Don't change gun when i click 1 or 2

Hello i am making a game that when i click 1 it shoes a gun and when i click 2 it shows another but i don’t know why it only changes if i stop the game and enter again.

this is the code

    public void Update()
    {
        if (Input.GetKeyDown("1"))
        {
                Deagle.SetActive(false);
                M4A1.SetActive(true);      
        }
        if (Input.GetKeyDown("2"))
        {
            Deagle.SetActive(true);
            M4A1.SetActive(false);
        }
    }

i think this should work. the problem why it is not switching must be somewhere else.

Question

at the start of this script does it say?

public GameObject deagle;
public GameObject m4a1;

and you properly added the corresponding gameobjects into the inspector slots?