Download

display helpful button tooltip according to controller type?

hey, what’s the best way show those “press A to interact” helpful text but change it according to what controller you are using to play, like all games do these days?

I have a box collision as a trigger volume that toggles the visibility of a simple text on begin and end overlap events (like the “press A to interact” I mentioned), but I wanted the text to change instantly the A letter to an icon of the assigned gamepad button, if it detects I’m using a gamepad.

about all games do this, if you are using say an xbox controller, it will show the xbox button icons as tooltips, but the minute you touch the mouse or the keyboard, the tooltips will change to the according keys.

how could I approach this?

Well I don’t know how but you should first recognize the player’s controller type, I wouldn’t be surprised if this was already in the engine.
Next depending on the controller type you should have some sort of boolean and then arrange branches to display the correct message depending on the controller type.

And to do this in real time you could create a custom event that triggers whenever the controller type changes and that causes the message to be rewritten on screen.

Edit : Actually I didn’t find a way to check the controller type so what I would do is a branch next to each keyboard input type with something like this => If controller is true => Set controller false => Set keyboard true => Call the event to refresh message
And I would do the opposite for gamepad inputs. The only downside I see is that I don’t know how to see which input was used for actions mapped like the default “jump”.

I see, that sounds good, gonna try it asap.

so basically I’m bruteforcing that code to all the possible inputs, but when you consider including mouse movement and gamepad stick movement, then basically you would be triggering events every tick, right? wouldn’t that be performance expensive to the hardware?

Well I mean from what I understand if a condition is let’s say true it won’t run the “false” part so the part where you call the event and change the variables would only happen when the controller type changes. The only extra step would be to check every tick if controller is true or if keyboard is true depending on the current controller used.

The ideal would be to apply this to actions mapped and not individual keys because it would take for ever, or maybe there is a way to call an event when a keyboard key is pressed or when a controller button is pressed ? That would surely help a lot.

there’s an “any key” event that triggers when anything on the keyboard is pressed, but I couldn’t find similar even to gamepad or mouse.

and I just found out that input events will override whatever I have assigned to those inputs, so if I assign anything to say left mouse button, or W key, then I will no longer be able to shoot or move forward, so that’s a deal breaker. perhaps I’m doing it wrong?

also, there isn’t a way from what I’ve seen to identify if the gamepad I’m using is a dualshock or xbox controller.

this is a shame, I’d expect such simple functionality to be already implemented, but from reading old threads this is not any sort of priority, so probably not gonna happen in a long time

Mhh yes you’d probably need to go deep into coding to get the actual controller model. The any key should work like you want but I don’t see how this could work with a controller sorry

Oh no this is easy!! Any Key does actually trigger from the controller as well. Just put an Any Key event in your actor. Click the node, and on the right you will get a menu, make sure this node is set not to Consume Input. In your actor’s default settings, make sure the actor receives input with the highest priority. Lastly, connect the event to a node called “is Gamepad Key", and use that to set a bool variable. I’ve been using this setup with no issues for 2+ years.

There is currently no way to get the gamepad type in Blueprint. I opted to let the player choose preferred gamepad labels in my options menu.

thanks man! that’s really heplful. gonna try this asap.

cheers!

did you ever figure out how to differentiate between xbox or ps4 controller?