Enhanced Input key with modifier

Hi everyone,
I recently started working with enhanced input and found that the documentation is missing. Couldn’t find any information about keyboard modifiers like in the old input system.

I only found this approach which looks like a square wheel. Is there a better/easier way?

3 Likes

Hey, you could create a new trigger (that derives from Input Trigger class) and check whether or not the modifier key is currently pressed. This can be done by overridding the UpdateState function, getting the Player Input outer (APlayerController) and using one of the input utility functions, i.e. Is Input Key Down. Promote the Key to a variable so you can set it in your mapping context later.


6 Likes

Yes, I did almost the same

This is actually the best way to do these. I found that the modifiers seem to either be set to be pressed at the same time or the modifier itself consumes the input. If you mash the buttons you can see them run occasionally but you have to hit it just right.

If you do it with the “Is Input Key Down” node there are no issues.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.