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).
-
Add trigger
released
in yourInput Mapping Context
-
Add trigger
released
in yourInput Action
What is your unreal version? I’m using 5.5 and at my computer is working just fine, Look:
// 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);
}
TIP: Cast
can be “heavy operation”, so I suggest you save at least one of them, e.g.:
if (AOrionCharacter* ControlledCharacter = Cast<AOrionCharacter>(GetPawn()))
{
ControlledCharacter->AttackButtonReleased();
}