I’ve spent hours now trying to get this working, I can’t see what I’m missing?
I keep getting the following error:
Severity | Code | Description | Project | File | Line | Suppression State | Details |
---|---|---|---|---|---|---|---|
Error | C2511 | ‘void ABaseSkaterCharacter::Move(FInputActionValue &)’: overloaded member function not found in ‘ABaseSkaterCharacter’ | DDCPP | E:\UnrealProjects\DDCPP\Source\DDCPP\Private\Characters\BaseSkaterCharacter.cpp | 28 |
Please can anybody help?
Header File:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "InputActionValue.h"
#include "BaseSkaterCharacter.generated.h"
class UCapsuleComponent;
class USkeletalMeshComponent;
class UInputMappingContext;
class UInputAction;
UCLASS()
class DDCPP_API ABaseSkaterCharacter : public ACharacter
{
GENERATED_BODY()
public:
ABaseSkaterCharacter();
virtual void Tick(float DeltaTime) override;
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
protected:
virtual void BeginPlay() override;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input)
UInputMappingContext* SkateMappingContext;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Input)
UInputAction* MoveAction;
void Move(const FInputActionValue& Value);
};
C++ File:
// Fill out your copyright notice in the Description page of Project Settings.
#include "Characters/BaseSkaterCharacter.h"
#include "Components/InputComponent.h"
#include "EnhancedInputSubsystems.h"
#include "EnhancedInputComponent.h"
ABaseSkaterCharacter::ABaseSkaterCharacter()
{
PrimaryActorTick.bCanEverTick = true;
}
void ABaseSkaterCharacter::BeginPlay()
{
Super::BeginPlay();
if (APlayerController* PlayerController = Cast<APlayerController>(GetController()))
{
if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem< UEnhancedInputLocalPlayerSubsystem>(PlayerController->GetLocalPlayer()))
{
Subsystem->AddMappingContext(SkateMappingContext, 0);
}
}
}
void ABaseSkaterCharacter::Move(FInputActionValue& Value)
{
const FVector2d MoveValue = Value.Get<FVector2d>();
float LeanInput = MoveValue.Y;
float SteerInput = MoveValue.X;
}
void ABaseSkaterCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// Input
void ABaseSkaterCharacter::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
// Set Up Action Bindings
if (UEnhancedInputComponent* EnhancedInputComponent = CastChecked<UEnhancedInputComponent>(PlayerInputComponent))
{
EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &ABaseSkaterCharacter::Move);
}
}