Menu Anchor

Overview of using Menu Anchors for use with Popup Menus.

Choose your operating system:





This widget allows you to specify a location that a popup menu should be anchored to and should be summoned from.


In the Details panel for a placed Menu Anchor, there are a couple of specific options that can be set that pertain to the Widget:




Menu Class

The Widget Blueprint (pop-up) to spawn when the menu is called. Creates the widget freshly each time.


Several placement options use to determine the location of the created widget.


Allows for the customization of the pop-up by binding a function or property to the OnGetMenuContent Event which is called when the pop-up is summoned (see below).


Allows for the customization of the pop-up by binding a function or property to the OnMenuOpenChanged Event which is called when the opened state of the menu changes.

For the OnGetMenuContent Event, you can create and bind a function directly from the Details panel which will be called whenever the Menu Anchor is called. This allows you to provide extra functionality to the creation of your pop-up menu. For example, below we've run a check to determine if the player is "In Battle" and if not, we allow them to access the pop-up menu. If they are we do not allow them to access the pop-up menu.


Blueprint Functions

The Menu Anchor widget has some widget specific functions that can be called through script which are described below.





Closes the menu if it is currently open.

Get Menu Position

Returns the menu's position in world space.

Has Open Sub Menus

Returns wether the menu has open sub menus or not.

Is Open

Checks to see if the Target Menu Anchor is currently open and returns a Boolean.


Opens the menu if it is currently closed.

Should Open Due to Click

Returns wether the menu should be openable by clicking or not.

Toggle Open

This toggles the open state for the menu and can be used instead of opening/closing.

Usage Example

Say you wanted to create an Inventory Menu and have a pop-up appear when the player clicks on a item, as seen in the example below.

The first thing you would want to do is create what your pop-up menu looks like.


Above we created a simple Widget Blueprint called MenuPopUp that is comprised of three Buttons inside a Vertical Box.

Next you would need to create another Widget Blueprint for your Inventory Menu, which we called HUD below.


After you have created your Inventory Menu, you would also add the Menu Anchor Widget (located under Primitive).


You would then position the Menu Anchor where you want it to appear, we positioned and Anchored it to the right/center position.


In the Details panel for the Menu Anchor, you would set the Menu Class (or Widget Blueprint to spawn) as well as its placement options.


On the Graph tab, you would add OnClick Events for each of your Buttons and drag in the Menu Anchor widget.

Dragging off the Menu Anchor, you can call the Open function to open and display your specified Menu Class.


The Focus Menu option, when selected, adds a outline box around the Menu Anchor and is optional.

After you have created the Inventory Menu, you would need to call that menu in-game somehow.

This could be through the Level Blueprint or (in our case) through the Default Pawn Class (which is set to use the MyCharacter Blueprint).


Above in our MyCharacter Blueprint, when the game is started we create the HUD Widget and store it as a variable called HUDWidget so we can access it later. We then set I to toggle between Add to Viewport and Remove from Parent to Display or Remove the Inventory Menu. We also set Show Mouse Cursor to enabled or disabled based on whether or not the Inventory Menu is open or not.

And finally inside the MenuPopUp Blueprint (your pop-up menu), adding some script to Close the Menu Anchor when the player presses a Button in the pop-up menu. Below when the pop-up is constructed, we get a reference to the MyCharacter Blueprint by Casting to it then promoting it to a variable called MyCharacterReference. With this reference we can then access the HUD


You would probably want to add some functionality for each of the buttons for your pop-up (instead of printing to the screen) that when pressed, does something. For example, perhaps the first button "uses" the item from the Inventory, while the second "drops" the item and the third "cancels" and returns the player to the Inventory Menu.

This is just one example, you could also change what causes the Menu Anchor to open. Instead of a button press, perhaps using the IsHovered function to determine if an object is being hovered over then opening the Menu Anchor and pop-up window to display a tool-tip or some other form of notification. In either case, this should get you started with using the Menu Anchor to display/remove pop-up widgets through script.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey