# how to use enhanced input for press, hold release

**URL:** <https://forums.unrealengine.com/t/how-to-use-enhanced-input-for-press-hold-release/2568831>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [June 21, 2025, 5:00am UTC](https://forums.unrealengine.com/t/how-to-use-enhanced-input-for-press-hold-release/2568831 "2025-06-21T05:00:06Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShaunM](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ShaunM](https://forums.unrealengine.com/u/ShaunM)\
**Post date:** [June 21, 2025, 5:00am UTC](https://forums.unrealengine.com/t/how-to-use-enhanced-input-for-press-hold-release/2568831/1 "2025-06-21T05:00:06Z")

</div>

I am attempting to set up enhanced input for my game to allow the following:

1. Tap the E key and the player fires the weapon once.
2. Tap and hold the E key to initiate automatic fire and cease when the key is released.

I am doing this in C++.

How can I make this happen with Enhanced Input?

---

<div class="post-metadata">

**Author:** ![SpecZynk](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/speczynk/32/1117840_2.png) [@SpecZynk](https://forums.unrealengine.com/u/SpecZynk)\
**Post date:** [June 21, 2025, 12:44pm UTC](https://forums.unrealengine.com/t/how-to-use-enhanced-input-for-press-hold-release/2568831/2 "2025-06-21T12:44:38Z")

</div>

Hi,

Hope you’re doing well.

1. Simple make a BindAction as Trigged type, e.g.  
`EnhancedInputComponent->BindAction(ShotAction, ETriggerEvent::Triggered, this, &AGameCharacter::Shot)`;

2. In the mapping context make the final ajustment adding two triggers, `pressed` and `hold`.  

Hope that helps - take care!

---

<div class="post-metadata">

**Author:** ![ShaunM](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ShaunM](https://forums.unrealengine.com/u/ShaunM)\
**Post date:** [June 21, 2025, 6:47pm UTC](https://forums.unrealengine.com/t/how-to-use-enhanced-input-for-press-hold-release/2568831/3 "2025-06-21T18:47:44Z")

</div>

Thank you.

But I’m still confused.

I understand how &AGameCharacter::Shot gets called when the button gets pressed and released for a single shot. But how does the code know when a Hold is finished so I can stop firing?

---

<div class="post-metadata">

**Author:** ![SpecZynk](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/speczynk/32/1117840_2.png) [@SpecZynk](https://forums.unrealengine.com/u/SpecZynk)\
**Post date:** [June 21, 2025, 6:56pm UTC](https://forums.unrealengine.com/t/how-to-use-enhanced-input-for-press-hold-release/2568831/4 "2025-06-21T18:56:44Z")

</div>

Don’t worry, that’s part of the journey.

Since we’ve set two triggers in the mapping context, it will trigger with a simple press or hold.

Pressed will be called once you press the key.  
Hold will be called while the key is pressed (holding).

By the moment you release the key, hold will stop.

Do you need any release implementation? I think the current implementation meets your specifications.

---

<div class="post-metadata">

**Author:** ![ShaunM](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ShaunM](https://forums.unrealengine.com/u/ShaunM)\
**Post date:** [June 21, 2025, 7:53pm UTC](https://forums.unrealengine.com/t/how-to-use-enhanced-input-for-press-hold-release/2568831/5 "2025-06-21T19:53:52Z")

</div>

Maybe I’m just being especially dense on this:  
Here are my bindings:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/optimized/4X/c/5/f/c5f5c735a3f0ed7239ffc133d7e904fb75f4a82c_2_690x25.png)  
Here are my methods being called:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/8/c/d8c3be3939b19ac949af67e5e2a6f5a892f6af9d.png)  
Here is my Attack input action:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/1/c/a1cf9fada6815f7255f518898b25ee1f718cf99a.png)  
and here is my IMC:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/2/5/d253e4de719b67cf2a53142a698246193dceec1b.png)

The problem is that my AOrionCharacter::StopAttacking() is never called.

---

<div class="post-metadata">

**Author:** ![SpecZynk](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/speczynk/32/1117840_2.png) [@SpecZynk](https://forums.unrealengine.com/u/SpecZynk)\
**Post date:** [June 21, 2025, 8:33pm UTC](https://forums.unrealengine.com/t/how-to-use-enhanced-input-for-press-hold-release/2568831/6 "2025-06-21T20:33:26Z")

</div>

Oh, I see.

That’s stranger, your EndAttack should be being called.

Are you sure your `UE_LOG` is not being printed on your `Ouput Log`?

Try one of the bellow implementation (or both).

1. Add trigger `released` in your `Input Mapping Context`  

2. Add trigger `released` in your `Input Action`  

What is your unreal version? I’m using 5.5 and at my computer is working just fine, Look:

```auto
// Input
EnhancedInputComponent->BindAction(ShotAction, ETriggerEvent::Triggered, this, &AClimbingSystemCharacter::Shot);
EnhancedInputComponent->BindAction(ShotAction, ETriggerEvent::Completed, this, &AClimbingSystemCharacter::EndShot);

void AClimbingSystemCharacter::Shot()
{
	Debug::Print("Shot", FColor::Green);
}

void AClimbingSystemCharacter::EndShot()
{
	Debug::Print("End Shot", FColor::Red);
}

```

 ![Captura de tela 2025-06-21 173649](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/a/e/eaed0d5a09ae47956a4db6de3d3e773118d51c29.jpeg)

**TIP** : `Cast` can be “heavy operation”, so I suggest you save at least one of them, e.g.:

```auto
if (AOrionCharacter* ControlledCharacter = Cast<AOrionCharacter>(GetPawn()))
{
	ControlledCharacter->AttackButtonReleased();
}

```

---

<div class="post-metadata">

**Author:** ![ShaunM](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ShaunM](https://forums.unrealengine.com/u/ShaunM)\
**Post date:** [June 21, 2025, 8:51pm UTC](https://forums.unrealengine.com/t/how-to-use-enhanced-input-for-press-hold-release/2568831/7 "2025-06-21T20:51:01Z")

</div>

My Unreal version is 5.5.4.

I have no idea how to print UE\_LOG messages to anywhere but the Output Window 🙂

I am restarting both VS and UE and deleted Binaries, Intermediate and Saved as well as the cache directory. Rebuilding VS files and restarting UE and then VS.

Will try your suggestions next.

---

<div class="post-metadata">

**Author:** ![ShaunM](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ShaunM](https://forums.unrealengine.com/u/ShaunM)\
**Post date:** [June 21, 2025, 8:56pm UTC](https://forums.unrealengine.com/t/how-to-use-enhanced-input-for-press-hold-release/2568831/8 "2025-06-21T20:56:56Z")

</div>

Adding Released to the InputMappingContext has solved the problem. Can you please explain?

---

<div class="post-metadata">

**Author:** ![SpecZynk](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/speczynk/32/1117840_2.png) [@SpecZynk](https://forums.unrealengine.com/u/SpecZynk)\
**Post date:** [June 21, 2025, 9:00pm UTC](https://forums.unrealengine.com/t/how-to-use-enhanced-input-for-press-hold-release/2568831/9 "2025-06-21T21:00:33Z")

</div>

Happy to know that.

So the `Input Mapping Context` is handling `Release` trigger event, such as `Pressed` and `Hold`, that’s all.

---

<div class="post-metadata">

**Author:** ![ShaunM](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ShaunM](https://forums.unrealengine.com/u/ShaunM)\
**Post date:** [June 21, 2025, 9:03pm UTC](https://forums.unrealengine.com/t/how-to-use-enhanced-input-for-press-hold-release/2568831/10 "2025-06-21T21:03:15Z")

</div>

Are you saying that Hold does not fire off a Completed event when the key is released?

---

<div class="post-metadata">

**Author:** ![SpecZynk](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/speczynk/32/1117840_2.png) [@SpecZynk](https://forums.unrealengine.com/u/SpecZynk)\
**Post date:** [June 21, 2025, 9:08pm UTC](https://forums.unrealengine.com/t/how-to-use-enhanced-input-for-press-hold-release/2568831/11 "2025-06-21T21:08:09Z")

</div>

No way.

Because you’ve bound the release here.

![c5f5c735a3f0ed7239ffc133d7e904fb75f4a82c_2_690x25](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/f/4/ff4f3ab840296e5a15b73585a5a666c48acd01ae.png)

Without this `Completed`, your `StopAttacking()` could not be called. I just said the `Input Mapping Context` is handling the `Released` fire as well.

That’s what it seems.
