- Home /
Gui Menu - Help Please.
So, I have this script
var quitMenu : boolean = false;
function Start () {
}
function Update () {
if(Input.GetKeyDown(KeyCode.Escape)) {
quitMenu = !quitMenu;
}
}
function OnGUI () {
if(quitMenu == true) {
if(GUI.Button(Rect(250,150,600,600), "Exit")) {
Application.Quit();
}
}
}
When I press Esc, I want my mouse to reappear because It's locked so I can press the button.
Comment
Answer by private void · Jul 05, 2013 at 02:57 PM
How did you hide the cursor?
if you have hidden it with Screen.showCursor = false;
then you could set it back to visible by this:
if(Input.GetKeyDown(KeyCode.Escape)) {
quitMenu = !quitMenu;
Screen.showCursor = quitMenu;
}
Answer by Xelo · Jul 06, 2013 at 09:21 AM
I actually used
function Start(){ Screen.lockCursor = true; }
And when I try to put after
quitMenu = !quitMenu;
the script
function Start(){ Screen.lockCursor = false; }
It gives me errors
Your answer
![](https://koobas.hobune.stream/wayback/20220613105536im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
FPC Mouselook Axis problem on pause GUI 1 Answer
menu issue and mouse click 0 Answers
Loading GUI in middle of mouse and make it work radial 1 Answer
changing from mouse click to keys 0 Answers
HighScore analytics 0 Answers