Can you map a UMG button to an input?

Is it possible to map a UMG widget button to a user input? For example: whenever this umg button is pressed, it is the same as pressing the ‘G’ key or a gamepad button and will activate my standard input action mappings.

I may be misunderstanding this, but couldn’t you just put your “G input” things into a function and just call this function from UMG and your input?

For that I would need to be able to tell 2 things: when the umg button is pressed, and when it is released. There is an event for it being pressed, but as far as I can tell there is no event for a button being released, and there is no sort of “is currently pressed” state that I can check.

To relate it back to the example: if ‘G’ moves a character forward, then I could get the UMG button to start moving the character forward, but how would I know when to stop?

I see your point. Without ReleaseEvents functionality on the UMG buttons implementing an Input Axis through a UMG button would be tricky if not impossible. I was thinking of Input Actions when I made my response above.

Hello Roboticals,

I have answered a similar question here:

4.5 UMG - how to get OnMouseButton events? - Programming & Scripting - Epic Developer Community Forums

I hope this helps.

Cheers

Hi Rudy,
That looks like the opposite of what I’m trying to do. Correct me if I’m wrong, but that answer seems to translate a key-down event to a widget event. What I’m trying to do is convert a widget button to a key–specifically both press and release as you could read in my earlier response to anXgotta.

Hello Roboticals,

You are correct, I misunderstood your question. Knowing this, I have a question for you. I read one of your later comments. It says that you would like your button to effectively have a “hold” and “release” function. Is that what you are actually aiming for or do you need the button to simulate an actual key press?

If you are looking for a hold and release style button I may have a workaround for you. There is an example here:

I hope this helps.

Cheers

simulating an actual key press would be ideal, but it is straight forward enough to work around that with a simple hold and release (if it were implemented). Thanks for the crazy workaround to getting it working with the current version of UE4–it’s ugly, but it works!

I have an update that makes the button a little better. I have added a way to fake the click effect. This may make this more of a viable option. All you need to do is revisit this link:

Was there any answer to the question: Convert a Widget button clicked event to a Axis Mapping such that when the button is pressed, the action specified in the Axis binding is invoked?

Was there any answer to the question: Convert a Widget button clicked event to a Axis Mapping such that when the button is pressed, the action specified in the Axis binding is invoked?

Hello chary

There is a node in 4.11 that is called “Listen For Input Action” that sounds like what you are looking for. I have provided an example below. I hope that this information helps.

84788-listenforinputactionhelp.png

Make it a great day