# Enhanced Input System misunderstandings.

**URL:** <https://forums.unrealengine.com/t/enhanced-input-system-misunderstandings/1312554>\
**Category:** Programming & Scripting\
**Tags:** newbie, Input, unreal-engine, question\
**Created:** [September 26, 2023, 8:30am UTC](https://forums.unrealengine.com/t/enhanced-input-system-misunderstandings/1312554 "2023-09-26T08:30:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Meytneriy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Meytneriy](https://forums.unrealengine.com/u/Meytneriy)\
**Post date:** [September 26, 2023, 8:30am UTC](https://forums.unrealengine.com/t/enhanced-input-system-misunderstandings/1312554/1 "2023-09-26T08:30:40Z")

</div>

Im new to Unreal Engine. For now i cant wrap my head around input system. I want to make switch items system with number keys(0-9). Do I really have to create different IA for every key? Or i can put all keys i need in IA and somehow get each pressed key from input event in graph? Because i dont see that keys in enhanced input system can return values vider than -1 to 1 in my case. As always, sorry if it sounds stupid.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [September 26, 2023, 9:26am UTC](https://forums.unrealengine.com/t/enhanced-input-system-misunderstandings/1312554/2 "2023-09-26T09:26:04Z")

</div>

> [@Meytneriy](#):
>
> sorry if it sounds stupid

I am going to sound stupid with you, _hold my blueprint_…

- if this is the IA:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/b/3/fb361e668caf8a834fef80886da617f0c51361e5.png)

- and this is my context:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/1/2/412e2cd116ca54b707e591ad8a448558f0fb7a79.png)

- must I really go full loopy spaghetti and:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/3/5/a357722dd9e8c4caf34962b190334860728b0b68.png)

To get the `Key` that triggered it? This is not even the full thing, you’d need to add exception handling here.

* * *

Why can’t we have nice things and have the key struct returned here?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/9/3/f933c65fe2b7507837e2d7de22cd12a5a9286414.png)

There might be a good reason (or a proper way!), asking for a friend.

---

<div class="post-metadata">

**Author:** ![Meytneriy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Meytneriy](https://forums.unrealengine.com/u/Meytneriy)\
**Post date:** [September 26, 2023, 10:07am UTC](https://forums.unrealengine.com/t/enhanced-input-system-misunderstandings/1312554/3 "2023-09-26T10:07:44Z")

</div>

That’s exactly what i meant. That loopy stuff looks terrible.

---

<div class="post-metadata">

**Author:** ![IrSoil](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@IrSoil](https://forums.unrealengine.com/u/IrSoil)\
**Post date:** [September 26, 2023, 2:16pm UTC](https://forums.unrealengine.com/t/enhanced-input-system-misunderstandings/1312554/4 "2023-09-26T14:16:43Z")

</div>

> **Incorrect answer#1**
>
> _upd: not the first time i confuse a nice custom feature in my project with default one. The content of answer#1 was about a custom solution made to pass a custom params along with action based on mapping settings. So, basically, move `EnhancedInput` to your project and extend it as you like it._
> 
> In InputMapping there is a field `ActionParam`, where you select a class derived from `UInputCustomParam`. And here you can attach custom parameter for each individual binding of particular InputAction.
> 
> Like:  
> [Key:1][IA\_SelectItemSlot][ActionParam:MyInteger=1]  
> [Key:2][IA\_SelectItemSlot][ActionParam:MyInteger=2]
> 
> Then you bind IA handler, that receives `const FInputActionInstance& ActionInstance` as param and from here you can do
> 
> ```c++
> auto Params = Cast<UMyCustomParam>(ActionInstance.GetCustomParamValue()))
> int ButtonIndex = Params->MyInteger;
> 
> ```
> 
> Not sure it’s available from BPs as is, but you can always wrap it for your needs.
> 
> That’s would be the most generic way of doing it.

Correct answer#2:  
[not tested] But if you need just an int\float value, instead of `ActionParam` you likely can, in a same way, for each binding in `InputMapping`, just add a modifier `Scalar`, that will scale resulting value of your input.

Like:  
[IA\_SelectItemSlot=1D float value]  
[Key:1][IA\_SelectItemSlot][Modifiers:Scalar=1]  
[Key:2][IA\_SelectItemSlot][Modifiers:Scalar=2]

_upd2: that’s okayish solution for discrete buttons, but it will fail on gamepad triggers if you assume them as such. So, applicability of this method is limited_

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [September 26, 2023, 2:42pm UTC](https://forums.unrealengine.com/t/enhanced-input-system-misunderstandings/1312554/5 "2023-09-26T14:42:41Z")

</div>

> [@IrSoil](#):
>
> [not tested] But if you need just an int\float value, instead of `ActionParam` you likely can, in a same way, for each binding in `InputMapping`, just add a modifier `Scalar`, that will scale resulting value of your input.

Now tested (and rather obvious once pointed out!):

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/9/9/c99568e20dff8cf8aebfb7f2a92fda4b58cb1c9b.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/5/d/a5d25e54f10589dd8c8a00267b1d28c407d2d061.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/d/c/ddcf2b401d3858c3e1ab98a2935564af87eb2597.png)

---

<div class="post-metadata">

**Author:** ![Meytneriy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Meytneriy](https://forums.unrealengine.com/u/Meytneriy)\
**Post date:** [September 27, 2023, 8:17am UTC](https://forums.unrealengine.com/t/enhanced-input-system-misunderstandings/1312554/6 "2023-09-27T08:17:11Z")

</div>

Thank you all very much. Saved a lot of my time.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [October 27, 2023, 8:17am UTC](https://forums.unrealengine.com/t/enhanced-input-system-misunderstandings/1312554/7 "2023-10-27T08:17:36Z")

</div>

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