- Home /
Changing the camera from first person to third person.
I want my player to be able to switch between a first person camera and a third person camera. This is the code I have but when I switch I can't move my player any more.
var camera1 : Camera;
var camera2 : Camera;
function Start () {
camera1.camera.active = true;
camera2.camera.active = false;
}
function Update () {
if(Input.GetKeyDown("c")) {
camera1.camera.active = false;
camera2.camera.active = true;
}
if(Input.GetKeyDown("v")) {
camera2.camera.active = false;
camera1.camera.active = true;
}
}
Do you have the script on one of the cameras? If so, the camera will be disabled before it can make the other enabled.
Answer by jasonkutty · Feb 13, 2014 at 05:43 AM
Do the following :
1)Place the script on an empty game object in the world. 2)Assign variables in the inspector 3)It should work now, If you previously kept the script enabled in the camera, it would not work, It must be assigned to an object apart from the ones you are activating/deactivating.
Your answer
Follow this Question
Related Questions
Third Person Camera Help? 0 Answers
How can I mimic this game's camera in Unity? 1 Answer
Access to the Camera of a First Person Controller 1 Answer
Third Person Flight Camera HELP!! 1 Answer
Weird Camera snap 1 Answer