movement disable when camera changes view

hi, im a student who just started using unity, i am making a shooting game that allows players to change between first and thrid person view, i managed to get the cameras to change miraculously but when i change to third person view and then back to first person view the controls do not work anymore.

and i am not very good at coding so i was wondering if someone could help guide me.

the code that i am using is:
var cam1 : Camera;

var cam2 : Camera;

function Update () {

 if(Input.GetKeyDown("1")){

      cam1.enabled = true;

      cam2.enabled = false;
 }
 if(Input.GetKeyDown("2")){

      cam1.enabled = false;

      cam2.enabled = true;
 }

}

Try to change camera’s depth.