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;
}
}
}