[UMG] Button Press & Release

Are there any plans for having OnRelease events implemented for UMG Buttons in future versions? In particular I’m wanting to implement “hold” functionality, but even trying to do a workaround is odd because the normal mouse/touch events don’t fire when pressing UMG buttons, so I can’t even set a state variable saying if the button is down or not.

There seems to be some of that functionality in the “Border” widget, but embedding a button inside a border takes away the mouse event functionality.

Hello Ruffian,

There is no current functionality for this. However, I will be sure to put in a feature request for this function. Until then I may have a possible work around for you to try.

Items needed:

  1. New widget with only one button
  2. 2 Custom events inside your character blueprint
  3. One bool variable inside your character blueprint

Step 1:

Create a new widget and place only one button in this widget. You will need to disable this button within the behavior tab (this is to stop the button from consuming input of mouse click events).

Step 2:

This will be done inside your character blueprint. Create 2 custom events (I named them “MouseOver” and “MouseNotOver”). These will fire off depending on if the mouse is over the button. You will then need a bool variable (I named mine “IsOver”). This will be used to tell the branch if the mouse is over the button.

18779-holdhelp2.png

Step 3:

This will be done inside the widget blueprint. You will need to cast an “Event On Mouse Enter” to your character blueprint and to the custom event there in (in my case it is called “MouseOver”). Then you will need to cast an “Event On Mouse Leave” to your character blueprint and to the custom event there in (in my case it is called “MouseNotOver”).

18791-holdhelp3.png

Step 4:

Add widget to view port.

This is Just an example. Please note that the button will be slightly grayed out and will not have a “click” animation. I hope this helps.

Cheers

I have an update for this button that allows it to “fake” being clicked. This involves changing the background color. If you have the button above all you will need to do is add what’s new in the following picture.

I made a releasable button with C++. You can check it out here : barisatamer

I agree with Ruffian. Being able to handle click, hold, and release would be helpful. Thanks.