Xelo
1
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.
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;
}
Xelo
3
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