I have multiple camera attached to separate empty game objects that surround the player. I want the camera to switch in order when the user presses the middle mouse button. However unity is not recognizing any of the objects in my scene. I’m guess I am forgetting to call something. Any help would be great!
//Player is the gameObject which holds the camera
Player.camera.active = false;
var CameraNum : int;
CameraNum = 0;
function Update ()
{
if(Input.GetMouseButtonDown(2))
{
CameraNum+=1;
Debug.Log ("You hit middle mouse button");
}
if(CameraNum == 1)
{
//CameraOne is an empty game object that is paired with a camera
CameraOne.camera.active = true;
Debug.Log ("Camera One active");
}
if(CameraNum == 2)
{
//CameraTwo is an empty game object that is paired with a camera
CameraOne.camera.active = false;
CameraTwo.camera.active = true;
Debug.Log ("Camera Two active");
}
if(CameraNum == 3)
{
//CameraThree is an empty game object that is paired with a camera
CameraTwo.camera.active = false;
CameraThree.camera.active = true;
Debug.Log ("Camera Three active");
}
}