Search code examples
buttoninputgame-developmentunreal-engine5unreal-blueprint

UE5.3 New EnhancedInputAction confused with strange Behaviour of the triggered pin (FPS Game)


I am working on a FPS game in Unreal Engine 5.3 and have implemented basic weapon firing handeled by the server, following This Tutorial. While Ive made a few changes these only affect the weapon logic, not that of the shooting itself.

Weapon Input Blueprints,

Shoot Weapon On Server Graph,

Svr_ShootWeapon function.

When using the old Unreal Engine input system as shown in 2 everything works as expected. However using the new Unreal Engine EnhancedInputAction which we are using in our project I run into some problems. From research it seems that the corresponding pins to the previous "Pressed" and "Released" pins are now "Triggered" and "Completed".

Weapon Input EnhancedInputAction.

However, using this, most times the first shot fired will be fired twice, sometimes even three times, instead of once for a single input.

2 Line Traces from Single input.

This does not happen with the old input system but does with the new. Does anyone know why this might be the case? I have the idea that the "Triggered", which runs every frame manages to get multiple inputs through to the server before it sets the isFiring bool to true but thats only speculation as I would assume the setting of the boolean shouldnt take more than a single tick. And in this case why doesnt it happen with the old "Pressed" pin?

Edit:

Input Action and Context Map

Changing the input to be consumed also does not fix the issue.


Solution

  • What you want is the Started execution pin which will only fire once assuming your InputAction Trigger (in your InputMappingContext) is Down and not Pulse

    enter image description here

    enter image description here

    If you want Triggered to only fire once, you need to make sure that the Trigger in your Input Action is set to Pressed

    enter image description here