- Home /
How do you switch between cameras?
So what I've been trying to do is make it so that I'm able to switch between cameras so at a press of a button I see a different area. My problem is that I can't seem to make it so my script works. It currently just stays on enabled camera and doesn't change (also as a side note, I have the script on my character). I've checked google and from what I could tell this script should work.
here is my current script.
var Camera1: Camera; var Camera2: Camera;
function Start() { Camera1.enabled = false; Camera2.enabled = true; }
if (Input.GetKey("1")) { Camera1.enabled = true; Camera2.enabled = false; }
if (Input.GetKey("2")) { Camera1.enabled = false; Camera2.enabled = true; }
Thanks!
Read the FAQ, and watch the tutorial video to learn how to format your code.
Answer by Graham-Dunnett · Jun 02, 2015 at 10:43 AM
Drop your key testing code inside a function called Update()
.
Your answer
Follow this Question
Related Questions
How do I get the camera to follow my character? 2 Answers
Making the players head face toward the location of the mouse? 1 Answer
Camera movement in a 2D? (like angry birds) 1 Answer
2d camera help! 0 Answers
Looking for picture in picture effect using Canvas Elements and Cinemachine follow target 0 Answers