camera switch script works?
Does this camera switch work. It's JAVA
pragma strict
var FPScamera : Camera; var TPcamera : Camera; var Topcamera : Camera;
private var camswitch : boolean = false;
function Start() { FPScamera.camera.enabled = true; TPcamera.camera.enabled = false; Topcamera.camera.enable = false; }
function Update() { if(Input.GetKeyDown("x")) { camswitch = !camswitch; }
if(camswitch == true)
{
FPScamera.camera.enabled = false;
TPcamera.camera.enabled = true;
Topcamera.camera.enable = false;
}
if(Input.GetKeyDown("C"))
{
camswitch = !camswitch;
}
if(camswitch ==true)
{
FPScamera.camera.enable = false;
TPcamera.camera.enable = false;
Topcamera.camera.enable = true;
}
else
{
FPScamera.camera.enabled = true;
TPcamera.camera.enabled = false;
Topcamera.camera.enable = false;
}
}
tring switch betwen 3 cameras. 1 FPS 1 TP= 3rd and 1 top view. i reid this and it says try get compnen instead. Does anyone anything wrong
Answer by Dev_Hampe · Jul 23, 2016 at 01:06 AM
pragma strict
var FPScamera : Camera;
var TPcamera : Camera;
var Topcamera : Camera;
private var camswitch : boolean = false;
function Start()
{
FPScamera.camera.enabled = true;
TPcamera.camera.enabled = false;
Topcamera.camera.enable = false;
}
function Update()
{
if(Input.GetKeyDown("x"))
{
camswitch = !camswitch;
}
if(camswitch == true)
{
FPScamera.camera.enabled = false;
TPcamera.camera.enabled = true;
Topcamera.camera.enable = false;
}
if(Input.GetKeyDown("C"))
{
camswitch = !camswitch;
}
if(camswitch ==true)
{
FPScamera.camera.enable = false;
TPcamera.camera.enable = false;
Topcamera.camera.enable = true;
}
else
{
FPScamera.camera.enabled = true;
TPcamera.camera.enabled = false;
Topcamera.camera.enable = false;
}
}
Your answer
Follow this Question
Related Questions
Switch between 5 cameras in the game by clicking. 0 Answers
How do I make the character rotate with the 2D camera? 0 Answers
How to delay render one camera for X ms? 1 Answer
Unity 3D: Third person movement and mouse camera control 0 Answers
Problems with rotation after zoom (camera like Sketchfab) 0 Answers