Show GUI.Box on Input

I’m trying to make a box wich shows my Health and Mana in my game. But I also want it to be able to show other stats when pressing a button. But i can’t seem to get it to work.

this is my code:

function OnGUI ()
{
	if(Input.GetKeyDown(KeyCode.Tab))
	{
		GUI.Box(Rect (0,0,100,100), "Health: " + Health + "\n Mana: " + Mana + "\n Strength: " + Strength + "\n Agility: " + Agility + "\n Willpower: " + Willpower);
	}
	else
	{
		GUI.Box(Rect (0,0,100,40),"Health: " + Health + "\n Mana: " + Mana);
	}
	
	
}

I tried to make a
print (“bla bla”);
And it printed the text, but it doesn’t seem to change the GUI.box

Input.GetKeyDown only returns true on the first frame the button is pressed.

Change it to Input.GetKey

Worked
Should’ve tried with that, wanted to make it show when pressing down so didn’t try anything else than GetKeyDown
but obviously i was wrong.

Thanks and take care :slight_smile: