- Home /
Question by
gameorchard · Jul 28, 2015 at 12:38 PM ·
cameracharacterscreenmultiple
Camera change script not working.
Hi there,
My script for camera changing doesnt work, it works on the first change but then does not for the second change from Camera 2 to Camera 3. Any help would be greatly appreciated. Heres the script:
var camera1 : Camera;
var camera2 : Camera;
var camera3 : Camera;
function Start () {
camera1.camera.active = true;
camera2.camera.active = false;
camera3.camera.active = false;
yield WaitForSeconds(35);
camera1.camera.active = false;
camera2.camera.active = true;
yield WaitForSeconds(5);
camera2.camera.active = false;
camera3.camera.active = true;
}
Comment
Best Answer
Answer by Positive7 · Jul 28, 2015 at 02:10 PM
#pragma strict
var camera1 : Camera;
var camera2 : Camera;
var camera3 : Camera;
function Start () {
camera1.GetComponent.<Camera>().enabled = true;
camera2.GetComponent.<Camera>().enabled = false;
camera3.GetComponent.<Camera>().enabled = false;
yield WaitForSeconds(35);
camera1.GetComponent.<Camera>().enabled = false;
camera2.GetComponent.<Camera>().enabled = true;
yield WaitForSeconds(5);
camera2.GetComponent.<Camera>().enabled = false;
camera3.GetComponent.<Camera>().enabled = true;
}
Your answer
![](https://koobas.hobune.stream/wayback/20220611233417im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to Keep Player in the Center of the Screen? 0 Answers
Handling different resolutions? 2 Answers
How can I change the camera? 2 Answers
Camera animation into a scene –most efficient way? 2 Answers