- Home /
Screen.showcursor = true won't work after Screen.showcursor = false
Hi,
I'm having the mouse visible during the start menu in my game. When I build the game and run it, the mouse shows up properly for the first time that you use the Start screen. After the Start screen, the cursor is hidden in the game. If you get through the level and return to the Start screen, the cursor remains hidden even though I need it to be visible.
I've tried to remedy this by putting
Screen.showCursor = true;
in both the Start() and OnGUI() functions on an object in my Start level, but the cursor stays hidden.
Any help is appreciated. Thanks!
Answer by jasonkutty · Feb 13, 2014 at 05:44 AM
Please make sure that there are no other scripts that are constantly updating the Screen.showCursor as FALSE.
For example :
Script1 : function Update() { Screen.showCursor = false; }
Script2 : function ChangeCursor() { Screen.showCursor = true; }
See what I mean? If another script is updating every frame to disable the screen.showCursor, then enabling it in another script would not work....
The only places in my entire solution that Screen.showCursor exists are in the Start scene's GUI script and in the Level1 scene's GUI script (separate scripts) Awake() function.
Try changing it to the start function, and make sure it's not placed in any loops or update functions.
It is in the Start() function in my Start scene and in the Awake() function in my Level1 scene.
Hm... that's odd. Try the following :
1) create a new scene, and place the scripts in that. 2) see if it reproduces the same problem. 3) If it does, it's not Unity's bugs/glitches.
I didn't change anything really, but somehow the darn thing works now, so I'm marking this as correct for your help. I really have no clue what happened.
Your answer
Follow this Question
Related Questions
Cursor not shown after changing scene 1 Answer
Why not showing up 1 Answer
Show Cursor in Menu 1 Answer
Standalone problem with cursor 1 Answer
How Can I Lock The Cursor Position? 1 Answer