Hi,
I am trying to create a interface, with a UFunction that is a BlueprintNativeEvent and then to implement that interface in an ActorComponent Class. I watch a lot of tutorials or read similiar Questions here in the forum. I think I set everything up the same way the tutorials did, but I still get the folllowing error:
“UCharacterStatsComponent::SetStatValue_Implementation”: method with override specifier ‘override’ did not override any base class methods
Here is my code:
UINTERFACE(BlueprintType)
class UCharacterStatsInterface : public UInterface
{
GENERATED_BODY()
};
/**
*
*/
class DBRACKETSABILITYSYSTEM_API ICharacterStatsInterface
{
GENERATED_BODY()
public:
UFUNCTION()
virtual FText GetStatValue(FText statName) = 0;
UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
void SetStatValue(FText statName, FText value);
};
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class DBRACKETSABILITYSYSTEM_API UCharacterStatsComponent : public UActorComponent, public ICharacterStatsInterface
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UCharacterStatsComponent();
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
virtual FText GetStatValue(FText statName) override;
void SetStatValue_Implementation(FText statName, FText value) override;
};
I implemented the methods like this in the UCharacterStatsComponent.cpp:
FText UCharacterStatsComponent::GetStatValue(FText statName)
{
return ICharacterStatsInterface::GetStatValue(statName);
}
void UCharacterStatsComponent::SetStatValue_Implementation(FText statName, FText value)
{
ICharacterStatsInterface::SetStatValue_Implementation(statName, value);
}
The method GetStatValue, which is not a BlueprintNativeEvent, does not cause an error and works. But the method SetStatValue always causes the error the I mentioned above.
Does someone have an idea what I am doing wrong?