[UMG] Working with Controller Input

Now that 4.6 is officially out, along with controller support, I’m curious about how to get it working. I guess this is a tips/tricks/basics thread.

Some stuff I’ve figured out so far:

If you want to focus on a widget, after construct use “set input mode UIOnly” and specify a button (or widget that can take focus), then you can navigate with a controller. If you specify the whole widget, focus won’t take and you need to click on a button or element to get the focus.

It looks like widgets still can’t take actual input, so I’ve got a ‘key bind’ dispatcher in my HUD blueprint that listens for the “use” key and “cancel” key (A & X on a 360 controller), which are relayed to the HUD. Clunky, but it works OK.

What I don’t understand at all: “Set User Focus” and the “event reply structure” it produces. I have no idea what this is, how it works, or what to do with it.
EventReplyStructure.JPG

I don’t see any way to change a widget based on focus. They all get a generic engine style dotted line when focused, but I don’t see any way it can be user specified.

Overall, it seems like controller support is technically workable in a bare minimum fashion, but is far from an actual working solution for shipping a game with controller support.

Some things I’d like to see in the future:

  • Focus works like ‘hovered’
  • the ability to detect ‘hovered’ or ‘focused’ so I can change elements within an element (for example: the color or font on a text element within a button)
  • the ability for a widget to actually take input. It seems nuts that a button can be clicked, but if I want a player to be able to execute an action with a controller button, I need to put the logic elsewhere and send it to the HUD.

Basic controller support is only in so far as Slate is concerned. Styling work and exposing it to the visual editor is still on the TODO list.

Can’t wait to see where it goes. Thanks :slight_smile:

Can you explain what you did for that? I’m trying to do something similar.

1 Like

Same problem! I’ve been working on this for hours and it’s driving me mad. How did you bind for A & X on the controller? Can you share your blueprint(s) please so we can see how to get focus? I’ve even set the keyboard focus like this:

Thanks,

Sorry, just catching up on old threads.

So to get input, 1st I added input under Project Settings -> Action Mappings.

I then use those action mappings in my global HUD blueprint (not a UMG blueprint) to catch & distribute the input. For example, I have an input mapping labeled “ToggleJournal” which accepts input from both the “i” key and the “triangle button”. On use, I check if the journal is open, and if it’s not I create the journal widget & add it to the viewport and assign it to a UIJournal variable. If it is open, I grab that variable and remove it from the viewport.

I’m doing similar with “use” interactions. I’m using the global HUD blueprint to manage them. So when the player is near a usable object, I use an interface to tell the HUD blueprint you’re near a usable object, and listens for input on the “use” action mapping. If I detect a use, and the player is near a usable object, I pass along the event to the object via a variable sent to the HUD when the object declared itself to be usable.

Does all this make sense? Basically it’s functional when I need to grab a single button press, but doesn’t work for stuff like navigating a list or using a UI with multiple buttons.

This thread is 4 years old, I am running into the exact same thing as the original user stated. Has anything been added in 4.18 like listed below? I am so not wanting to rebuilt my perfect mouse widget menus to work with a console controller.

Some things I’d like to see in the future:

  • Focus works like ‘hovered’
  • the ability to detect ‘hovered’ or ‘focused’ so I can change elements within an element (for example: the color or font on a text element within a button)
  • the ability for a widget to actually take input. It seems nuts that a button can be clicked, but if I want a player to be able to execute an action with a controller button, I need to put the logic elsewhere and send it to the HUD.

We had to build our own mouse / keyboard / gamepad system from scratch after investigating further into the base systems Unreal provides.

Maybe there are proper ways to use the built-in systems but we did not found them.

PS: And I indeed had to rebuild my buttons animations & juice :stuck_out_tongue:

Glad I found this thread.
I have the same problem as stated here, and was wondering if I was missing something.

I guess I will find a solution like Stuckbug did, since Im not into c++
using blueprints to prototype.

Here is the fix :slight_smile: Hope it helps!

This video is quite long but may help shed some light on UMG controller inputs and best practices. https://www.youtube.com/watch?v=2JbFZI1Zdc4