- Home /
Question by
kris 3 · Mar 24, 2011 at 09:12 AM ·
cameraswitchswitch cameras
Switching cameras?
Hello, I know this is kind of a newbie question, but how in scripting would I make it so when you push a button, it disables one camera, and enables another?
Im making a basic house design with unity and want to be able to switch from first person to birds eye :)
thanks kris
Comment
Answer by robertmathew · Mar 24, 2011 at 09:33 AM
var camera1 : Camera; var camera2 : Camera;
function Start() { camera1.enabled = true; camera2.enabled = false; }
function OnGUI()
{
if(GUI.Button(Rect(10,10,50,20),"button"))
{
camera2.enabled = true;
camera1.enabled = false;
}
}
Your answer
Follow this Question
Related Questions
Camera switching trouble 2 Answers
Changing Cameras 2 Answers
Character movement when I switch cameras. 0 Answers
Switch to second camera which has all the GUI 3 Answers
Switching cameras (JavaScript) 0 Answers