Hi there guys
I want to let my right mouse button switch a GUI on and off, but I just can’t get it to fire only once when I press the button!
Thanks
function OnGUI () {
if(Input.GetButton("Fire2"))
{
if(isScopeOpen == "false")
{
isScopeOpen = "true";
}
else
{
isScopeOpen = "false";
}
}
if(isScopeOpen == "true")
{
// Make a group on the center of the screen
GUI.BeginGroup (Rect (Screen.width / 2 - 512, Screen.height / 2 - 384, 1024, 768));
// All rectangles are now adjusted to the group. (0,0) is the topleft corner of the group.
// We'll make a box so you can see where the group is on-screen.
GUI.Box (Rect(0,0,1024,768),GUIContent(scopeBg));
//GUI.Box (Rect (0,0,100,100), "Group is here");
//GUI.Button (Rect (10,40,80,30), "Click me");
// End the group we started above. This is very important to remember!
GUI.EndGroup ();
}
}