`OnGUI` is called every frame (well, multiple times each frame). If you want a box to appear when a button is pressed, you need a variable to be set to true when the button is pressed. You can then display the box when the variable is true. You'll need some way to turn this variable to false, but it's not clear when this should happen.
↧