Hi i found this code online
var camera1 : Camera; var camera2 :
Camera; function Start () {
camera1.enabled = true;
camera2.enabled = false; }
function Update () { if
(Input.GetKeyDown ("2")){
camera1.enabled = false;
camera2.enabled = true; } if (Input.GetKeyDown ("1")){
camera1.enabled = true;
camera2.enabled = false; } }
which basically changes the camera in game and it works fine but i tried to alter it so instead of pressing the key 2 or 1 i wanted to make it so when you right click it changes so i changed the code so instead of it saying Input.GetKeyDown(‘‘1’’)) i changed it to say UnityEngine.Input.GetMouseButton(1)) but in game it dosent work when i right click heres the code that was altered
**
var camera1 : Camera;
var camera2 : Camera;
function Start () {
camera1.enabled = true;
camera2.enabled = false;
}
function Update () {
if (UnityEngine.Input.GetMouseButton(1)) {
camera1.enabled = false;
camera2.enabled = true;
}
if (UnityEngine.Input.GetMouseButton(1)) {
camera1.enabled = true;
camera2.enabled = false;
}
}
**
Thanks