- Home /
Standalone problem with cursor
Hey, I added this script to my game and built in in standalone pc format but I can't get my cursor visible when I push escape or P... anyone maybe knows why? do I haft to do something more than just add the script?
Do I haft to do something in Input Manager?
private var shouldPause : boolean = false; private var isPaused : boolean = true;
function Update () {
if(Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.P)) { shouldPause = !shouldPause ; }
if(!shouldPause && isPaused ) { Screen.lockCursor = true; Time.timeScale = 1; isPaused = true; } else if(shouldPause && !isPaused) { Screen.lockCursor = false; Time.timeScale = 0; isPaused = false; } else if(!Screen.lockCursor && !shouldPause) { shouldsPause = true; }
}
Answer by SpeedySpikes · Apr 30, 2011 at 01:02 PM
You neglected to put code to actually show and hide the cursor. Locking the cursor locks it in it's place and does that only. Use this code somewhere to show your cursor:
Screen.showCursor = true;
And when you want to hide it again...
Screen.showCursor = false;
Hope this helps!
Well, I still got a problem... it doesn't work in standalone pc format...
Is there code somewhere else that hides the cursor? I am making a standalone game, too, and my custom cursor wasn't hiding the real one until I found a "Show Cursor" script activated in one of my game objects. I disabled it and it worked like a charm.
Your answer
Follow this Question
Related Questions
Cursor not working after changing scene 1 Answer
Cursor unlocking on player 1 Answer
how to make the cursor ACTUALLY lock 0 Answers
Standalone problem with cursor 3 0 Answers
add lockcursor to pause menu script?? 2 Answers