Download

UMG: button template and click event

Hi.

I’ve created a button template basing on UserWidget. Simply this template is about neccesarry images/text. Now I want to use this button in different HUD’s with different Click event. But as I can see, there is no such opportunity. I can override Click Event only in my base template, but not in certain button placed on the HUD.

Is that so bad ?

Well you’re not making a template - you’re making an entirely new kind of widget with new potential behaviors. We don’t have the concept of ‘prefab/template’ in UMG where it’s just a collection of existing widgets. If you wanted to expose widget events of internal widgets in your userwidget you’ll need to define a new custom event like in other blueprints that you fire when the internal click event occurs.

Hi, Nick
Thank you for answer. I’ll try it.

I know this is a very old topic but I found it googling for precisely this issue. I have a custom user widget (a button with some extras) where the actual button is but one of the children.

Now (in 2020!!!) to support events you can simply add an EventDispatcher in the blueprint graph of your custom widget.

Don’t forget to make it instance editable as shown in the screenshot.
Then you can just click on the respective event in your actual button within your widget and connect it with your event dispatcher.

eventdispatcher.png

After that your custom widget will have an event which can be used just like if it was a button itself.