how to switch in multiple camera's?
Hello! Good Am/Pm! I am having trouble on how to switch multiple different cameras by pressing V because when i tried my script the player will automatically stop from moving by pressing V and that's not what i want, I want if player press V its switch the "MainCamera" to "Cam2" and i do not know how to fix it..All answers will be kindly appreciated.
public class Cam1Switch : MonoBehaviour
{
public GameObject MainCamera;
public GameObject Cam2;
void Start() {
MainCamera.SetActive(true);
Cam2.SetActive(false);
}
void Update() {
if(Input.GetKeyDown(KeyCode.V))
{
MainCamera.SetActive(false);
Cam2.SetActive(true);
}
}
}
Is your movement script attached to your $$anonymous$$ainCamera object? If so either
Place the script on another object
Disable the Camera script instead of the whole gameObject
public Camera $$anonymous$$ainCamera;
public Camera Cam2;
void Start() {
$$anonymous$$ainCamera.enabled = true;
Cam2.enabled = false;
}
void Update() {
if(Input.GetKeyDown(KeyCode.V))
{
$$anonymous$$ainCamera.enabled = false;
Cam2.enabled = true;
}
}
Your answer
Follow this Question
Related Questions
What this error? 0 Answers
Respawn Script Is Not Functioning 0 Answers
Game Does Not Work Properly 0 Answers
isometric view is rendering weird help :O 0 Answers
Needing a hand circumventing a "Missing Reference Exception". Any help sincerely appreciated! 1 Answer