camera switch

how i can switch a camera on unity ?:face_with_spiral_eyes:

enable/disable

Can someone show the script to switch cameras please

Yeah…
How???

http://forum.unity3d.com/threads/57922-Unity-3D-Enable-Disable-Cameras-In-Hierarchy

Just drag your cameras to the camera1 and camera2 variables in the inspector. Should switch when you press C.

var camera1 : Camera;
var camera2 : Camera;
private var cameraSwitch : boolean = true;

function  Update ()
{
if (Input.GetKeyDown ("c"))
{
cameraSwitch = !cameraSwitch;
camera1.enabled = cameraSwitch;
camera2.enabled = !cameraSwitch;
}
}

Thanks he really works but i need to use a trigger and not a key or button,sorry to be a pain

Attach this to your trigger object and set the collider to “is trigger” in the inspector.

var camera1 : Camera;
var camera2 : Camera;

function OnTriggerEnter ()
{
camera1.enabled = false;
camera2.enabled = true;
}

function OnTriggerExit()
{
camera1.enabled = true;
camera2.enabled = false;
}

Thanks man he works smoothly