Question by
TippyStatue9 · May 24 at 08:36 AM ·
guikeycode
My gui box will not disappear on keyboard input.
```
bool showConsole = true;
string input;
private void OnGUI()
{
if (Input.GetKeyDown(KeyCode.F3))
{
showConsole = !showConsole;
}
{
if (!showConsole)
{return;}
float y = 0f;
GUI.Box(new Rect(0, y, Screen.width, 40), "Debug Console");
GUI.backgroundColor = new Color(0, 0, 0, 0);
input = GUI.TextField(new Rect(10f, y + 5f, Screen.width - 20f, 20f), input);
}
if (showConsole)
{
Debug.Log("Debug Console Shown");
}
else
{
Debug.Log("Debug Console Hidden");
}
}
```
Comment
Your answer
Follow this Question
Related Questions
Event.KeyCode not detecting mouse click 0 Answers
Custom inspector KeyCode Selector 0 Answers
How to create an if statement for each element within a list C# 2 Answers
Unity 5.1 GUI mask disappears in Android build 0 Answers
Adjusting content display. 0 Answers