I have a pause menu that comes up when a button is pressed. I want to stop the camera from moving while the pause menu is up, but everything I’ve tried doesn’t work. Any suggestions?
a few things that i can think of, i presume u have a separate script for your pause menu in which case when the script is enabled have the camera component either frezze its position or disable the object and have a new camera for pause menu and then vice versa.
i dont know what type of game it is but on my game the camera is following my player and because everything in the game is done with a fixed update function when i pause my game changing the time to 0 everything stops except sound. the pause menu is then in an update function which still works.
Add an if statement and boolean to the camera rotation script and have the boolean dependent on the game state. so something like this:
var gamePaused : boolean = false;
function Update () {
if (!gamePaused){ keep rotating...}
}
The game is in the first person perspective (using the First Person Controller from Unity). All the stuff I’ve looked at for freezing the camera either does nothing, or throws an error.
Alright. Put one camera object behind the Character Controller, other than the First Person Controller Camera. Deactivate it initially, which goes like this:
var otherCam : GameObject;
var whenTheMenuBarIsRaised : boolean = true;
function Start(){
otherCam.active = false;
}
function Update() {
if(whenTheMenuBarIsRaised)
{
otherCam.active = true;
//Deactivate the FPS Camera
whenTheMenuBarIsRaised = false;
}
}