Maintain input while in the menu + Allow menu to be closed on second keypress

Hello,

I had an issue with the input being disabled while opening the in game menu, I figured that since it’s an ingame menu the player input would need to remain.

This can be achieved with a seperate function to load the menu with the inputmode as FInputModeGameAndUI:
functions.cpp

after this you can create the following calls to the gameinstance blueprintcallable functions to open and close the menu on the escape key:

In a later lecture it turned out it’s better to move the bool into the gameinstance, because some other call could unload the menu from the cancel button and then you would need to press Escape twice for the menu to show again.

In the Gameinstance.h file:
public:
UFUNCTION(BlueprintCallable, Category = “User Interface”)
bool IsInGameMenuShown();
protected:
bool bInGameMenuIsShown = false;

in the .cpp file you just have to set bInGameMenuIsShown to true on the Load fuction and false at the end of the unload function.

Privacy & Terms