I am fairly new to scripting and I want to be able to switch between two camera views using the same input key, in this case “1”. At the moment the script I created does’t work and was wondering if anybody could help me in making the script function as I intend it to.
The Script I currently have is:
var cameraFirstPerson : Camera;
var cameraThirdPerson : Camera;
function Start()
{
cameraFirstPerson.enabled = true;
cameraThirdPerson.enabled = false;
}
function Update ()
{
if (cameraThirdPerson == true || Input.GetKeyDown("1"))
{
cameraFirstPerson.enabled = true;
cameraThirdPerson.enabled = false;
}
if (cameraFirstPerson == true || Input.GetKeyDown("1"))
{
cameraFirstPerson.enabled = false;
cameraThirdPerson.enabled = true;
}
}