Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Getting reference to a widget created by the Menu Anchor.


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.


Product Version: UE 4.18
more ▼

asked Nov 18 '17 at 10:38 PM in Blueprint Scripting

avatar image

45 3 9 14

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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:

alt text

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.

capture.png (227.8 kB)
more ▼

answered Nov 18 '17 at 11:08 PM

avatar image

14.6k 76 25 61

avatar image Allshar Nov 18 '17 at 11:33 PM

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.

avatar image Everynone Nov 19 '17 at 12:29 AM

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

alt text

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.

capture.png (63.3 kB)
avatar image Allshar Nov 19 '17 at 09:54 AM

That worked. Thanks.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question