Camera switch help

Hello,

I’m having this really big issue with my camera script. I’m trying to say if the key “R” is pressed, the camera will switch to another camera. However the editor keeps telling me that a semicolon is needed and I can’t seem to figure out why this is the problem. I have ";"s everywhere in my script, but I just don’t understand. Any help is appreciated.

Camera Camera1;
Camera Player;
function Update () {
if (Input.GetKeyDown(R.c));
{
Camera1.enabled=true;
Player.enabled=false;
}
else{
Camera1.enabled=false;
Player.enabled=true;
}


}

To me, it looks like you are combining some c# and some JS.

It should look something like this for JS: (Untested code)

var Camera1 : Camera;
var Player : Camera;

function Update () {
if (Input.GetKeyDown(KeyCode.R)) {
Camera1.enabled=true;
Player.enabled=false;
} else {
Camera1.enabled=false;
Player.enabled=true;
}
}

Yeah I thought so. :slight_smile: Thank you very much for the help! I’ll give it a go.