This is something that makes UMG scripting a pain for me. Maybe I’m missing something here, but accessing arbitrary widget in my UserWidget hierarchy is problematic. Assume that I have a widget with following hierarchy:
Root SizeBox ScrollBox VerticalBox Button
I want to script following behavior: after clicking the button, a new custom widget is created and added to VerticalBox. To achieve this I need an access to VerticalBox in the OnClicked event. Unfortunately it is not added automatically to blueprint variables, as is the case with button. I need to go down the tree from Root or get the Button variable and go to its parent. What is more, I can’t cache the result, because it’s impossible to create variable of non BlueprintType variable (on the side note: UMG editor can magically create such variables, eg. for buttons). Accessing widgets this way, every time I need them, is a bit tedious.
Is there a way to do it better? And why aren’t UWidgets BlueprintTypes?