Question by
Ethan_i_ran_out_of_ideas · Jul 19, 2017 at 03:22 PM ·
unity 5camerajavascriptcamera-movement
help with switching camera
im trying to make something where the main camera switches to x:17.24 and then back to x:0 when right clicking again. but it doesent do anything: static var phase : int = 0; public var cameraprefab : GameObject;
function Update() {
if (Input.GetButtonDown("Fire1")) {
if (phase == 0) {
phase = 1;
cameraprefab.transform.Position.x = 17.24;
};
if (phase == 1) {
phase = 0;
cameraprefab.transform.Position.x = 0;
};
};
};
Comment
Your answer
Follow this Question
Related Questions
Switching player controllers 0 Answers
Tilting a camera around an object 0 Answers
camera falling down when following player!! 1 Answer
Top Down Game - Camera Follow Player and General Scripting Question 0 Answers
How to set Camera Limits in Unity that would stay accurate for different screen ratios? 2 Answers