# Enhanced Input key with modifier?

**URL:** <https://forums.unrealengine.com/t/enhanced-input-key-with-modifier/486208>\
**Category:** C++\
**Tags:** unreal-engine, keyboard, question\
**Created:** [July 14, 2021, 7:09pm UTC](https://forums.unrealengine.com/t/enhanced-input-key-with-modifier/486208 "2021-07-14T19:09:31Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Ravoltz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ravoltz](https://forums.unrealengine.com/u/Ravoltz)\
**Post date:** [July 14, 2021, 9:22pm UTC](https://forums.unrealengine.com/t/enhanced-input-key-with-modifier/486208/2 "2021-07-14T21:22:43Z")

</div>

So I actually found out how to do this but I’m not a big fan of this approach since the whole idea behind input actions is that they are input method/key binding agnostic.

I noticed the “Chorded Action” trigger and this basically allows you to have an action only triggered when another one is triggered. Using these I created separate input actions for my keyboard modifier keys. They all have the same properties. I unchecked “Consume input” but this depends on your needs.

 ![344107-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/a/e/eae1584d01aade0f2cf843cbe79e76cffa36c504.png)

I then created two input mapping contexts. I add the keyboard modifier action mappings to the keyboard mapping context so that I can just always have that mapping loaded and make use of those actions in other mappings.

Then I added some actions that have the same key assigned to them but only one of them triggers based on the keyboard modifier because of the “Chorded Action” trigger.

 ![344108-2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/6/7/367fabb37f5eaabcdbc3591590e8ca6db592470c.png)

I added the context mappings and added event handlers for the input actions. Note that I had to use a branch to check for the action value when coming from the Started exec pin because the started event may be called with a false value. I don’t know why but I guess this is just how it comes together. If you use the triggered exec pin it seems you can go without it. I used Started here because i like to have a single event instead of all the time but this depends on your use case.

I also used a higher priority for the keyboard action mapping context so make sure it gets the input first and together with the “Consume Input” being false I can still later use any modifier key for any other key binding.

 ![344109-3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/7/0/c70b4939ead02c6d3e2fc9322949b64f9da9406c.png)

Now I can press Shift+1 to activate ability 1 and Alt+1 to activate ability 2!

---

_[View the full topic](https://forums.unrealengine.com/t/enhanced-input-key-with-modifier/486208)._
