Hi there
I’m trying to make a script to toggle between cameras, but unity is bringing up the following:
(5,23): warning CS0108: `CamerChange.camera' hides inherited member `UnityEngine.Component.camera'. Use the new keyword if hiding was intended
Please help me, i’m a N00b at scripting
Below is my code:
using UnityEngine;
using System.Collections;
public class CamerChange : MonoBehaviour {
public Camera camera;
public Camera camera2;
public Camera camera3;
public KeyCode ChangeCameraKey;
void Start(){
camera.enabled = true;
camera2.enabled = false;
camera3.enabled = false;
}
void Update(){
int usingcamera = 0; //this initializes a camera control variable
//This toggles between cameras
if(Input.GetKeyUp(ChangeCameraKey)){
if (usingcamera == 1) {
camera.enabled = true;
camera2.enabled = false;
camera3.enabled = false;
usingcamera = 2;//goes to camera
}
if (usingcamera == 2) {
camera.enabled = false;
camera2.enabled = true;
camera3.enabled = false;
usingcamera = 3;//goes to camera2
}
if (usingcamera == 3) {
camera.enabled = false;
camera2.enabled = false;
camera3.enabled = true;
usingcamera = 1;//goes to camera3
}
}
}
}