- Home /
One Last GUI Question
So I been working on this script for a little bit now. I finally got it to work right which I'm happy about. I added a little bit to it and theres no errors but I have a problem. See the thing is when I start the game Screen.LockCursor = true which I like. And I added that into the script. And I added when you open the menu Screen.LockCursor = false and that works. But my problem is when I close the menu Screen.LockCursor still is false. Can you help out?
var GUIon:boolean;
function Start(){
GUIon = false;
Screen.lockCursor = true;
}
function Update(){
if(Input.GetButtonDown("Menu"))GUIon=!GUIon;
}
function OnGUI(){
if(GUIon){
Screen.lockCursor = false;
GUI.Box (Rect (0,0,500,300), "FOV");
if (GUI.Button (Rect (20,20,80,80), "FOV = 70")) {
Camera.main.fieldOfView = 70;
}else if (GUI.Button (Rect (100,20,80,80), "FOV = 80")) {
Camera.main.fieldOfView = 80;
}else if (GUI.Button (Rect (180,20,80,80), "FOV = 90")) {
Camera.main.fieldOfView = 90;
}
}
}
Answer by agamedesigner · Aug 03, 2012 at 08:06 PM
Since UnityAnswers' indentation is horrible, I've posted it here: http://pastebin.com/auiJzuZs
I'm sorry for my noobiness with coding. But does this go at the end?
Your answer
Follow this Question
Related Questions
Resolutions 1 Answer
Lock cursor everywhere not center,how? 1 Answer
Locking cursor without changing position 1 Answer
screen.lockcursor locks the cursor in wrong place 1 Answer
Screen.lockCursor not working? 3 Answers