So I’m trying to do a single and auto fire mode for ranged weapon.
EnhancedInputComponent->BindAction(FireAction, ETriggerEvent::Triggered, this, &UWeaponComponent::FireWeapon);
EnhancedInputComponent->BindAction(FireAction, ETriggerEvent::Completed, this, &UWeaponComponent::ClearTimers);
This is how I bind the InputAction to Function, and the action is mapping to Left Mouse Button in UE editor.
These are the functions related to the whole fire action event. (they only allow me to embed one file )
It works perfectly when I am in single fire mode. However, in Autofire mode once I pressed LMB I keep shooting till running out of ammo. My debug msg shows me that after the FireAction being trigged, it never get into Completed stage even my LMB is released and gave me the debug msg in ClearTimers() it shoulda called…
Is there a way to cancele the trigger state? I saw a ETriggerEvent::Canceled out there. If not, how can I fix it so I can get to the ClearTimers and stop shooting?