EDIT: I FIXED THE ISSUE, THE CODE IMPLEMENTATION BELOW WORKS FINE.
Hi there,
I can’t manage to compile c++ class with interface implemented in it.
PlayerController_Interface.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "PlayerController_Interface.generated.h"
/**
*
*/
UINTERFACE(Blueprintable, MinimalAPI)
class UPlayerController_Interface : public UInterface
{
GENERATED_UINTERFACE_BODY()
};
class IPlayerController_Interface
{
GENERATED_IINTERFACE_BODY()
public:
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Fancy")
FString FancyFunction() const;
};
PlayerController_Interface.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "ProjectSpace.h"
#include "PlayerController_Interface.h"
UPlayerController_Interface::UPlayerController_Interface(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
}
And here i implement interface to player controller
PlayerControllerBase.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/PlayerController.h"
#include "PlayerController_Interface.h"
#include "PlayerControllerBase.generated.h"
/**
*
*/
UCLASS()
class PROJECTSPACE_API APlayerControllerBase : public APlayerController , public IPlayerController_Interface
{
GENERATED_BODY()
public:
virtual FString FancyFunction_Implementation() const override;
};
PlayerControllerBase.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "ProjectSpace.h"
#include "PlayerControllerBase.h"
FString APlayerControllerBase::FancyFunction_Implementation() const
{
return "Hello";
}