- Home /
Question by
sixShOOter50o0 · Jul 03, 2013 at 10:56 AM ·
screen
Cursor lock/unlock not working
i did a lot of research on this, my script seems fine to me but when i press esc the cursor does not show up as i made it do in the script, it just appears for a split second then goes away...
here's the script:
//Is the game paused?
var paused : boolean = false;
//GameObjects
var gunCam : GameObject;
var PauseTextOne : GameObject;
var PauseTextTwo : GameObject;
var PauseTextThree : GameObject;
var PauseTextFour : GameObject;
function Awake()
{
PauseTextOne.active = false;
PauseTextTwo.active = false;
PauseTextThree.active = false;
PauseTextFour.active = false;
}
function Update ()
{
if(Input.GetButtonUp("Pause"))
{
if(!paused)
{
Time.timeScale = 0;
paused = true;
GetComponent(MouseLook).enabled = false;
gunCam.GetComponent(Camera).enabled = false;
Screen.showCursor = false;
PauseTextOne.active = true;
PauseTextTwo.active = true;
PauseTextThree.active = true;
PauseTextFour.active = true;
Screen.lockCursor = false;
Screen.showCursor = true;
}
else
{
paused = false;
Time.timeScale = 1;
GetComponent(MouseLook).enabled = true;
gunCam.GetComponent(Camera).enabled = true;
Screen.showCursor = true;
PauseTextOne.active = false;
PauseTextTwo.active = false;
PauseTextThree.active = false;
PauseTextFour.active = false;
Screen.lockCursor = true;
Screen.showCursor = false;
}
}
}
Comment
Answer by sixShOOter50o0 · Jul 03, 2013 at 12:27 PM
Fixed the problem.... i had previously added a hide cursor thing in another script xD but now it has been removed. sorry for posting an answer to myself.