# Getting reference to a widget created by the Menu Anchor.

**URL:** <https://forums.unrealengine.com/t/getting-reference-to-a-widget-created-by-the-menu-anchor/409990>\
**Category:** UI\
**Tags:** unreal-engine, menu, Widget, Blueprint, question, UMG\
**Created:** [November 18, 2017, 10:38pm UTC](https://forums.unrealengine.com/t/getting-reference-to-a-widget-created-by-the-menu-anchor/409990 "2017-11-18T22:38:01Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allshar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Allshar](https://forums.unrealengine.com/u/Allshar)\
**Post date:** [November 18, 2017, 10:38pm UTC](https://forums.unrealengine.com/t/getting-reference-to-a-widget-created-by-the-menu-anchor/409990/1 "2017-11-18T22:38:01Z")

</div>

Hello

Is there a way to access a widget created by the menu anchor?  
For example, I want to be able to pass some additional data to it after creation.  
I can access the class, but not the actual created widget.

Getting child / content / parent doesn’t work.  
I know I could use a construct event in the menu blueprint to get the data from a player controller for example, but I want to have multiple menus open at once so I have no way of telling them which one is which.

Thanks.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [November 18, 2017, 11:08pm UTC](https://forums.unrealengine.com/t/getting-reference-to-a-widget-created-by-the-menu-anchor/409990/2 "2017-11-18T23:08:24Z")

</div>

> a widget created by the menu anchor?

Not sure what that means but storing references to created widgets will allow you to access and manipulate their data. Getting child/parent is fine but requires casting and can be a tad fiddly since you need to know the expected class.

> I want to have multiple menus open at  
> once so I have no way of telling them  
> which one is which.

If you are instantiating dynamically, instead of storing widget references in an array (just an index) you can store them in a Map with proper names:

 ![220659-capture.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/a/7/ea74486a0862a505f7292328b64cc232af10699c.png)

In this case, I’ve created 10 widgets, gave them unique names and pushed them into a Map. I then access the one at index 6 and change its slider value.

You can, of course, make do with just an array but then you’ll need to remember indexes. I still use an index here because it’s a silly example. Assigning unique names as map keys can really help you identify and fetch objects faster. Again, depends on the project’s scope.

---

<div class="post-metadata">

**Author:** ![Allshar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Allshar](https://forums.unrealengine.com/u/Allshar)\
**Post date:** [November 18, 2017, 11:33pm UTC](https://forums.unrealengine.com/t/getting-reference-to-a-widget-created-by-the-menu-anchor/409990/3 "2017-11-18T23:33:09Z")

</div>

Spawning my own widgets is not a problem.  
I was using “Menu Anchor” element - it is specifically designed to spawn a widget of a given class when triggered (it has some options to make it easier to specify a relative location of the new widget). So I don’t create a widget by hand - I call “Open” on the Menu Anchor and it spawns its “menu class” widget. There is however no way that I can see to access that new widget.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [November 19, 2017, 12:29am UTC](https://forums.unrealengine.com/t/getting-reference-to-a-widget-created-by-the-menu-anchor/409990/4 "2017-11-19T00:29:58Z")

</div>

Forgot that thing existed. Set MenuClass to None and create a widget in the anchor’s binding:

 ![220671-capture.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/5/9/25902288f86f3501701a8babcc79dc9303d787e8.png)

Save it in a reference. This will allow you to access it for as long as it’s valid. The anchor will destroy it when it disappears, though and create a new instance next time.

Variables have an _Expose on Spawn_ flag which will allow you to customise it on creation while the reference can be used to access it afterwards.

---

<div class="post-metadata">

**Author:** ![Allshar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Allshar](https://forums.unrealengine.com/u/Allshar)\
**Post date:** [November 19, 2017, 9:54am UTC](https://forums.unrealengine.com/t/getting-reference-to-a-widget-created-by-the-menu-anchor/409990/5 "2017-11-19T09:54:54Z")

</div>

That worked. Thanks.

---

<div class="post-metadata">

**Author:** ![officernickwilde](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/officernickwilde/32/547477_2.png) [@officernickwilde](https://forums.unrealengine.com/u/officernickwilde)\
**Post date:** [August 7, 2023, 9:16am UTC](https://forums.unrealengine.com/t/getting-reference-to-a-widget-created-by-the-menu-anchor/409990/6 "2023-08-07T09:16:51Z")

</div>

In 5.1, is this response still relevant?

Looking in the source code “OnGetUserMenuContentEvent” is not set to BlueprintAssignable, dragging a pin out from an anchor reveals no option to override this delegate:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/8/7/587cd8ef296c3c81f3f05133fbbc02012ec9e8a0.png)

`From Engine/Source/Runtime/UMG/Public/Components/MenuAnchor.h` :

```cpp
	/** Deprecated. Called when the menu content is requested to allow a more customized handling over what to display */
	UE_DEPRECATED(4.26, "Use OnGetUserMenuContentEvent instead, you may need to make the previous binding return an User Widget.")
	UPROPERTY(EditAnywhere, Category = "Events", meta = (DeprecationMessage = "4.26. Use OnGetUserMenuContentEvent instead, you may need to make the previous binding return an User Widget."))
	FGetWidget OnGetMenuContentEvent;

	/** Called when the menu content is requested to allow a more customized handling over what to display */
	UPROPERTY(EditAnywhere, Category="Events")
	FGetUserWidget OnGetUserMenuContentEvent;

```

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 7, 2023, 9:20am UTC](https://forums.unrealengine.com/t/getting-reference-to-a-widget-created-by-the-menu-anchor/409990/7 "2023-08-07T09:20:01Z")

</div>

> [@officernickwilde](#):
>
> In 5.1, is this response still relevant?

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/d/4/fd43724fb0faa0da4f017b2e19216c2600ee63fd.png)

---

<div class="post-metadata">

**Author:** ![officernickwilde](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/officernickwilde/32/547477_2.png) [@officernickwilde](https://forums.unrealengine.com/u/officernickwilde)\
**Post date:** [August 7, 2023, 9:20am UTC](https://forums.unrealengine.com/t/getting-reference-to-a-widget-created-by-the-menu-anchor/409990/8 "2023-08-07T09:20:30Z")

</div>

ooo, thank you!

---

<div class="post-metadata">

**Author:** ![officernickwilde](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/officernickwilde/32/547477_2.png) [@officernickwilde](https://forums.unrealengine.com/u/officernickwilde)\
**Post date:** [August 7, 2023, 9:26am UTC](https://forums.unrealengine.com/t/getting-reference-to-a-widget-created-by-the-menu-anchor/409990/9 "2023-08-07T09:26:15Z")

</div>

Actually, I dont have that

This is in a UUserWidget with a UMenuAnchor component:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/0/a/70a2ffe9580e15483475a8e37e1e2dbeacfd27c1.png)

This is in a UMenuAnchor child blueprint (sorry about the edit, my first screenshot was incorrect):

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/7/1/9715cc5eebac40187f7b63aae4fd1bbc4c8e4b25.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 7, 2023, 9:31am UTC](https://forums.unrealengine.com/t/getting-reference-to-a-widget-created-by-the-menu-anchor/409990/10 "2023-08-07T09:31:44Z")

</div>

You need to be in the Widget Designer:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/0/0/d0015d14833ee3fcd45ecb88975983a8b1ef1724.png)

---

<div class="post-metadata">

**Author:** ![officernickwilde](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/officernickwilde/32/547477_2.png) [@officernickwilde](https://forums.unrealengine.com/u/officernickwilde)\
**Post date:** [August 7, 2023, 9:33am UTC](https://forums.unrealengine.com/t/getting-reference-to-a-widget-created-by-the-menu-anchor/409990/11 "2023-08-07T09:33:48Z")

</div>

Ah, okay. Sorry for the confusion, it works now 🙂

---

<div class="post-metadata">

**Author:** ![SerenVie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SerenVie](https://forums.unrealengine.com/u/SerenVie)\
**Post date:** [March 13, 2025, 10:42am UTC](https://forums.unrealengine.com/t/getting-reference-to-a-widget-created-by-the-menu-anchor/409990/12 "2025-03-13T10:42:07Z")

</div>

This man, right here, is a legend.
