GUI opens and closes

I’ve got ‘m’ top display a menu but it just opens and closes in an instance.

else if (binding.equals("MainMenu")) { if (menuOn == 0) { nifty.gotoScreen("InGameMenu"); menuOn = 1; }else if( menuOn == 1 ) { nifty.gotoScreen( "InGameMenu" ); menuOn = 0; } }

I've fixed this by opening the menu with 'm' and closed with 'n' but it's unrealistic to expect users to have two buttons to open and close a menu.
How do i fix this and why doesn't it work in the first place?

You react to the button down and up event. The boolean says which it is.

1 Like

Thanks. I was wonder what that was for.