So at the moment I made 2 levels and I want to use the same function for both the buttons. In the function I need to know which button is clicked, so I can open the right level. I can’t find anything on the internet. Can someone else help me with this?
I meet the same question recently and my solution is :
create a single widget class and a blueprint widget for the “buttons”
add these buttons to a parent panel such as Wrapbox UniformGridPanel or sth that can contain multi children dynamically, then in C++ class ,write this line
‘this->GetParent()->GetChildIndex(this)’
then you can get the index of the dynamically created buttons ,use the unique index to continue your codes
but be cautions,it seems like the chileindex only be gotten correctly after PreConstruct and Construct, in Tick.
Poor English but hope it can help!