- Home /
My game pauses when i switch cameras
for some reason when i want to switch from the main camera to a secondary camera by disabling, it just pauses the game
this is the script i use
pragma strict
var MainCamera : Camera;
var AimCamera : Camera;
function Start () {
}
function Update () {
if (Input.GetButtonDown("Aim"))
{MainCamera.gameObject.active = false;
AimCamera.gameObject.active = true;
}
}
http://answers.unity3d.com/questions/16146/changing-between-cameras.html
I think if you disable your camera, rendering can not continue.
Answer by LukaKotar · Sep 11, 2013 at 05:20 AM
You are disabling the only camera in the scene, before activating the second one. For a moment the scene has no active camera, which is my guess why the game pauses. First enable the second camera and then disable the first, so that there is always at least one camera always enabled.
Or you could just change the camera's depth without enabling and disabling the game objects. The camera with the highest depth will be shown on the screen, all the others will be ignored.
Your answer
Follow this Question
Related Questions
Switch Camera to a Menu 1 Answer
Swapping Cameras Disables Keyboard Input 3 Answers
setting a character controller orientation by script 1 Answer
Switching camera effects 1 Answer
Issues with switching cameras 1 Answer