How to create pause menu

I have added a button in each level and when the pawn presses the button pause menu will appear . I had added 3 buttons in pause menu i.e resume ,restart and main menu . So now I want create functions for the button. But I don’t know how to do that . Can anyone help me out . Any help is appreciated !!

You’ll first want to set up in button widget to pause the game once the widget is created by using the set game paused node.

Next, you’ll select each of the buttons and on the details pane on the right, you can scroll down to the events and select either OnClicked or OnPressed. It will then take you to the event graph. For the Resume, you’ll want to use set game is paused false in the same way as you did in the button widget when creating the main menu widget and then use the Remove from Parent to destroy the main menu widget.

The restart could be as easy as calling open level to the same level you’re currently on and clicking the main menu is similar where you use open level and put the name of the main menu map.

Tip: Anything that you want to be able to run while the game is paused will have to be coming off of a custom event and you can select the custom event and in the right you can select to have it run while paused.

Tip 2: If you’re wanting to use ‘Esc’ as the Main menu button, select it to be used when paused and set a boolean to track when you create/destroy the widget by setting a reference to the widget when creating it and then if it is open (boolean is true) then use the reference to remove from parent.

Yup !! It worked :slight_smile: