- Home /
Question by
davidflynn2 · Aug 20, 2013 at 08:13 PM ·
buttonkey pressedgui state
Making a button switch on and off a GUI
I am trying to figure out how to make the M key on the keyboard turn on a gui when its press then turn off the GUI again when it is hit. I have setup a map and that's what I am wanting to make it for.
Comment
Best Answer
Answer by Ejlersen · Aug 20, 2013 at 08:18 PM
private bool draw = false;
void OnGUI()
{
if (!draw)
return;
}
void Update()
{
if (Input.GetKeyUp(KeyCode.G))
{
draw = !draw;
}
}
Your answer
Follow this Question
Related Questions
Android Button 3 Answers
Is there any function to check how long a button is pressed? 2 Answers
Looking to map a GUI to a persons hand 0 Answers
On button press/hold = input from a keyboard? 1 Answer
How to register a held down key. 1 Answer