I am trying to use enhanced input components in Unreal 5.1 but I get this error:
CryptRaiderCharacter.cpp(91): [C2665] ‘UEnhancedInputComponent::BindAction’: none of the 4 overloads could convert all the argument types
The line of the error:
void ACryptRaiderCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
...
if (UEnhancedInputComponent* EnhancedInputComponent = CastChecked<UEnhancedInputComponent>(PlayerInputComponent))
{
EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &ACryptRaiderCharacter::Move); // error here
}
}
void ACryptRaiderCharacter::Move(FInputActionValue& Value)
{
const float DirectionValue = Value.Get<float>();
if (Controller && DirectionValue != 0.f)
{
FVector Forward = GetActorForwardVector();
AddMovementInput(Forward, DirectionValue);
}
}
Declarations
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input)
UInputAction* MoveAction;
void Move(FInputActionValue& Value);
What is the problem ?
Found solution Move
function need to be like this:
void ACryptRaiderCharacter::Move(const FInputActionValue &Value)