# Enhanced Input System: when are input actions set to be executed

**URL:** <https://forums.unrealengine.com/t/enhanced-input-system-when-are-input-actions-set-to-be-executed/2012976>\
**Category:** C++\
**Tags:** Input, unreal-engine, question, CPP\
**Created:** [September 9, 2024, 9:45am UTC](https://forums.unrealengine.com/t/enhanced-input-system-when-are-input-actions-set-to-be-executed/2012976 "2024-09-09T09:45:52Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![WSwinks](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@WSwinks](https://forums.unrealengine.com/u/WSwinks)\
**Post date:** [September 17, 2024, 2:13pm UTC](https://forums.unrealengine.com/t/enhanced-input-system-when-are-input-actions-set-to-be-executed/2012976/6 "2024-09-17T14:13:03Z")

</div>

> [@WSwinks](#):
>
> From the constructor of the Pistol class, I call the function `SetupPistolInputActions()`. Inside this function, I bind the `IA_Shoot_Left` and `IA_Shoot_Right` input actions to the functions that I want to be executed when these events are triggered. I noticed that for the `IA_Shoot_Left`, I didn’t have to load the input action, which was defined in Blueprint, because it was already loaded, while for the `IA_Shoot_Right`, I had to explicitly load the Blueprint input action. How is this possible? For now, I load both input actions explicitly, just to be safe.

By using the reference viewer in the Unreal Editor, I discovered a hard reference to the `IA_Shoot_Left` input action in the `VRTemplateMap`. I removed some custom Blueprints from the level and then added them back, which eliminated the hard reference. I believe this hard reference was the reason why the `IA_Shoot_Left` input action was being loaded prematurely.

> [@WSwinks](#):
>
> When I run the application, I used the `showdebug enhancedinput` command to see what was happening when I pressed the buttons related to the pistol. I noticed that when I pressed the buttons coupled with the `IA_Shoot_Left` and `IA_Shoot_Right` input actions, the inputs were triggered; however, the functions bound to these inputs were not executed. This only happens after I pick up the weapon and add the input mapping context. What exactly does adding the input mapping context do? Does this enable the propagation of the input action to the function it is bound to?

My reasoning was way off here. It had nothing to do with the input mapping context. The function I wanted to execute was a server RPC. As long as the pistol was not grabbed, it had no owner, and as a result, the server RPC could not be executed. In the Output Log, I also received the following warnings:

```auto
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor CustomPistol_0. Function ServerShootLeft will not be processed.
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor CustomPistol_1. Function ServerShootLeft will not be processed.
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor CustomPistol_0. Function ServerShootRight will not be processed.
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor CustomPistol_1. Function ServerShootRight will not be processed.

```

Additionally, the Input Mapping Contexts were applied immediately when the EI subsystem was ready. This was because the “Add Immediately” option was checked under **Project Settings \> Engine \> Enhanced Input \> Default Mapping Contexts**.

 ![DefaultMappingContexts](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/7/5/67571045914f4d71e0dab0c95f612ec265eeceac.png)

> [@WSwinks](#):
>
> Finally, is it possible to bind two input actions to one function and use a parameter to distinguish which input action called the function, or is this considered not done?

I didn’t find the exact answer I was looking for; however, some suggestions are provided in this [post](https://forums.unrealengine.com/t/can-i-use-bindaction-with-lambda/353633). For now, I still use separate functions for each input action.

---

_[View the full topic](https://forums.unrealengine.com/t/enhanced-input-system-when-are-input-actions-set-to-be-executed/2012976)._
