When I pause my game I want the player camera to freeze, so when I move the cursor around to chose a menu option, the inGame camera doesn’t move around. Here’s my pause script. I added some code to try and fix this, and it looks right to me, but it doesn’t work. I’d love some help with this problem. Tnx in advance
var paused : boolean = false;
var myCheck : boolean = false;
function Start(){
paused=false;
}
function Update () {
if(Input.GetButtonDown( "Pause" ) ) {
if(!paused) {
Time.timeScale = 0;
paused = true;
Screen.lockCursor = false;
firstPersonControllerCamera = gameObject.Find("First Person Controller").GetComponent("MouseLook");
mainCamera = gameObject.Find("Main Camera").GetComponent("MouseLook");
firstPersonControllerCamera.enabled = false;
mainCamera.enabled = false;
}else{
Time.timeScale = 1;
paused = false;
Screen.lockCursor = true;
firstPersonControllerCamera.enabled = true;
mainCamera.enabled = true;
}
}
}
function OnGUI() {
if( paused ) {
if(GUI.Button (Rect ( 500, 90, 100, 30), "Restart" )) {
Time.timeScale = 1.0f;
Application.LoadLevel( "stage2" );
}
if(GUI.Button (Rect ( 500, 130, 100, 30), "Options" )) {
}
if(GUI.Button (Rect ( 500, 170, 100, 30), "Quit" )) {
}
}
}