need help regarding game objects beginner

hi friend i have two game objects first is player that contains a camera and the second gameobject is another camera named as “quality” . so what i want to do is on pressing ESC key i want my player game object to get disable or inactive and the quality gameobject to be enabled . and on second time i press Esc key then it should be opposite means the quality get disabled and player gets enabled. plz help me i have gone throught all the tutorials but cant get success … if anyone can provide me some help

If you do that, it’s over. Your game object will be deactivated, with all its components. It means that your script will be deactivated too.

You need a script to handle this change attached to another game object that will handle the switch between the two game objects.

Something like that :

var player:GameObject;
var quality:GameObject;

void Update () {
     if (Input.GetKeyDown (KeyCode.Space)) {
         var isActive:boolean = player.activeSelf();
         player.SetActive(!isActive);
         quality.SetActive(isActive);
     }
 }

And in the inspector, set the variables player and quality.