# 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:** 8\
**Page:** 1

<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, 7:09pm UTC](https://forums.unrealengine.com/t/enhanced-input-key-with-modifier/486208/1 "2021-07-14T19:09:31Z")

</div>

I am trying to use the Enhanced Input plugin but I can’t find a way to add a mapping for a keyboard key with a modifier to the input mapping context. For example I want to add two separate input actions and use shift+A and alt+A for them respectively.

---

<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!

---

<div class="post-metadata">

**Author:** ![DustEyezz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DustEyezz](https://forums.unrealengine.com/u/DustEyezz)\
**Post date:** [March 18, 2023, 5:52pm UTC](https://forums.unrealengine.com/t/enhanced-input-key-with-modifier/486208/3 "2023-03-18T17:52:24Z")

</div>

WOW, this is actually so annyoing, especially with widgets. Hope this will get addressed.

---

<div class="post-metadata">

**Author:** ![ButtStal1ion1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ButtStal1ion1](https://forums.unrealengine.com/u/ButtStal1ion1)\
**Post date:** [July 11, 2023, 6:51pm UTC](https://forums.unrealengine.com/t/enhanced-input-key-with-modifier/486208/4 "2023-07-11T18:51:51Z")

</div>

I’ve found another, more elegant way to do it! Inspired by the solutions proposed here.

In my case, I have two separate actions mapped to the scroll wheel. The first action (IA\_CameraZoom) is mapped only to the scroll wheel for zooming in/out the camera view (my game is third-person BTW). The second (IA\_PlayerMovSpeedChanged) is a combination of holding the right mouse button + the scroll wheel to change the character’s movement speed (exactly like the shortcut used in the editor). Here’s my setup using only one context mapping and three input actions.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/3/8/d38d739c67c81746ae3b4bbce27fff9378ce6c1e.png)

Pay attention to the button mapped to IA\_PlayerMovSpeedChanged and IA\_CameraZoom. I have two input actions mapped to the same button (scroll wheel), but they have two different purposes in the system! I need to hold the right mouse button and scoll to actually trigger IA\_PlayerMovSpeedChanged. Otherwise, only IA\_CameraZoom is triggered when using the scroll wheel.

---

<div class="post-metadata">

**Author:** ![lab-one](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lab-one/32/780274_2.png) [@lab-one](https://forums.unrealengine.com/u/lab-one)\
**Post date:** [October 25, 2023, 8:44am UTC](https://forums.unrealengine.com/t/enhanced-input-key-with-modifier/486208/5 "2023-10-25T08:44:46Z")

</div>

It seems in 5.3 I was not able to trigger chorded action, when chord modifier was in another input mapping. Had to workaround by placing modifier into the same input mapping context.

---

<div class="post-metadata">

**Author:** ![Scottimus06](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/scottimus06/32/469167_2.png) [@Scottimus06](https://forums.unrealengine.com/u/Scottimus06)\
**Post date:** [November 3, 2023, 4:42pm UTC](https://forums.unrealengine.com/t/enhanced-input-key-with-modifier/486208/6 "2023-11-03T16:42:38Z")

</div>

Anyone know who to get to the blueprint level for an input action (if possible)? The last image shows the ModifierKey approach ([Enhanced Input key with modifier - #2 by shq300](https://forums.unrealengine.com/t/enhanced-input-key-with-modifier/763258/2))… If not possible, can someone shed light on how that poster did that?

---

<div class="post-metadata">

**Author:** ![Chardek1884](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chardek1884/32/766848_2.png) [@Chardek1884](https://forums.unrealengine.com/u/Chardek1884)\
**Post date:** [November 16, 2023, 3:58pm UTC](https://forums.unrealengine.com/t/enhanced-input-key-with-modifier/486208/7 "2023-11-16T15:58:02Z")

</div>

I believe they are creating a new blueprint class deriving from the InputTrigger class (as they said as much :))

To do this you can just right click in the ContentBrowser and select Blueprint \> Blueprint Class and then select InputTrigger as the base class

You will then be able to override the UpdateState function as shq300 did

---

<div class="post-metadata">

**Author:** ![Ligazetom](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ligazetom](https://forums.unrealengine.com/u/Ligazetom)\
**Post date:** [January 2, 2024, 9:43am UTC](https://forums.unrealengine.com/t/enhanced-input-key-with-modifier/486208/8 "2024-01-02T09:43:37Z")

</div>

Just wanted to provide you with little tut I did on this topic:

> **[Modifier key triggers - Enhanced Input | Community tutorial](https://dev.epicgames.com/community/learning/tutorials/vz52/unreal-engine-modifier-key-triggers-enhanced-input)**
>
> In this short tutorial I'd like to show you how to trigger Input Actions only if some modifier key (Ctrl, Alt, Shift...) is pressed as well. All this in...
