Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

button click area to the left of button

$
0
0
If I use hard numbers everything works fine but if I use variables my clickable area is to the left. Has anyone seen this issue? This is only in the .exe (so far as I know) works fine in the editor. #pragma strict var quitMenu : boolean = false; var cursorLockBool; var buttonWidth = 200; var buttonHeight = 50; var xPos : int; var yPos : int; function Start () { xPos = (Screen.width - buttonWidth)/2; yPos = (Screen.height - buttonHeight)/2; cursorLockBool = true; Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; } function Update () { if(Input.GetKeyDown(KeyCode.Escape) && !cursorLockBool) { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; cursorLockBool =true; } else if(Input.GetKeyDown(KeyCode.Escape) && cursorLockBool) { Cursor.lockState = CursorLockMode.Confined; Cursor.visible = true; cursorLockBool = false; } if(Input.GetKeyDown(KeyCode.Escape)) { quitMenu = !quitMenu; } } function OnGUI () { if(quitMenu == true) { if(GUI.Button(Rect(xPos, yPos, buttonWidth, buttonHeight), "restart")) { Application.LoadLevel (0); } if(GUI.Button(Rect(xPos, yPos - buttonHeight, buttonWidth, buttonHeight), "quit")) { Application.Quit(); } } } **EDIT** Just discovered it is only off in full screen mode. in windowed mode the buttons line up. **EDIT** Seems that the click boxes are not the same size as the visible buttons, even when hard numbers

Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>