Is it possible to tag/ reference a button created in widget?

Hi,

I wounder if it’s possible to tag or reference a button created in widget? And to do this in Blueprint?
The reason is pretty much in this question post:

Is it maybe possible to use GamePlay Tags esxplained here?:

What I have down so far (but a bit tedious) is to set an int var just after each button is hovered.
After the set variable I am executing a CircularProgressBar function for about 2sec. After that I get the int var and use SwitchOnInt to direct the event flow depending on which button is hovered.

If the button is unhovered before the CircularProgressBar function has finished, it will abort the flow execution, with a isAbortProgressBar bool var just before the SwitchOnInt node.
Basically setting the bool just after the unhovered event.

I guess it works ok, but it feels it becomes ineffective if you have alot of buttons in a widget, having to set the int var repeatingly after each button event.

Thanks for any input!

Easiest way to get what you’re looking for is to subclass the UButton class and create your own custom button. You can get references to your button or add a int variable to store the tag.

Hi CatsNipYummy, thanks for your reply. When you talk about subclass the UButton, do you mean something like done in this video?:


Or is it possible to achive with Blueprints only?

Thanks!

You can either use C++ or Blueprints. If you want the blueprints implementation, take a look at this tutorial. Creating a Dynamic UMG System | Community Led Training | Unreal Engine - YouTube Somewhere around the 30 min mark she talks about custom buttons using BP. That worked for me.

I’m sure I must not understand what you mean. Is this what you are looking for?

After this is checked in UMG Designer you can access the button object just like any other variable.

Sorry if I misunderstood.

Thanks for the link! That’s what I was looking for. Good tutorial!

Thanks for the input Enearle, no worries but yes I was more looking for a smart way to tag a button if you have several of them. “CatsNipYummy” sent a very good link tut of how it could be done:

It’s somewhere about 30min into the video.