I’m trying to write a script that will switch cameras and back again on mouse click. At the moment, it only switches once. What should I do to make it switch multiple times?
var walking = true;
var camera1 : Camera;
var camera2 : Camera;
function Update () {
if(Input.GetButtonDown("Fire1") && walking == true){
change1();
}
if(Input.GetButtonDown("Fire1") && walking == false){
change2();
}
}
function change1 (){
camera1.camera.active = true;
camera2.camera.active = false;
walking = false;
print ("Switch1");
}
function change2 (){
camera1.camera.active = false;
camera2.camera.active = true;
walking = true;
print ("Switch2");
}