相机系统无法正常工作

时间:2015-06-30 12:25:18

标签: unity3d unityscript

我的相机系统有些问题。以下代码用于激活10台摄像机系统中的camOne。这是代码:

//The cameras that I want to use
var playerCam : Camera;
var camOne : Camera;
var camTwo : Camera;
var camThree : Camera;
var camFour : Camera;
var camFive : Camera;
var camSix : Camera;
var camSeven : Camera;
var camEight : Camera;
var camNine : Camera;
var camTen : Camera;
var ChangeCameraToOne : boolean = false;

//This function is for changing the ChangeCameraToOne variable from false to true when the Gui Text is clicked.
function OnMouseDown() {
    ChangeCameraToOne = true;
}

//This function is used to Change the ChangeCameraToOne Variable to flase if  the Gui Text is hidden.
function OnBecomeInvisible() {
    ChangeCameraToOne = false;
}

//Here is the function where everything is going to happen.
function Update() {
    if(ChangeCameraToOne == true) {
          playerCam.enabled = false;
          camOne.enabled = true;
          camTwo.enabled = false;
          camThree.enabled = false;
          camFour.enabled = false;
          camFive.enabled = false;
          camSix.enabled = false;
          camSeven.enabled = false;
          camEight.enabled = false;
          camNine.enabled = false;
          camTen.enabled = false;
    }
}

因此,基本上单击GUI文本以启用camOne并禁用其他文件,但是当我单击GUI文本时,没有任何事情发生。我做错了什么或者我错过了什么?

0 个答案:

没有答案