Switch through cameras.

I have two cameras in my scene and I wan to switch between them. Getting the button to do it is easy but I cannot seem to find the way to enable the switching. If you can point me to the necessary functions I will do it. Thank you all, up until now you have been very helpful with my Unity3D endeavors :smile:

Simple set the active property, like this:

var CamOne : GameObject;
var CamTwo : GameObject;


function Switch() {
   CamOne.active = !CamOne.active;
   CamTwo.active = !CamTwo.active;
}

For more than one camera, it gets about 2 lines longer, I have code for that at home because it’s also something I’m doing right now.

Hallo, in my case it works with the following

function Update () { 
   if (Input.GetKeyDown("f")) { 
      camera.enabled = !camera.enabled; 
   } 
}

Why not using SelectActiveRecursively?

Thanks for the replies. I used a mixture of your suggestions.