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;
}
}
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.
Use .enabled = true
and .enabled = false