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.
asked Nov 18 '17 at 10:38 PM in Blueprint Scripting
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.
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:
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.
Follow this question
Once you sign in you will be able to subscribe for any updates here