Hello, I have interface class (Interactable) which I am trying to use as a function parameter in another class (InteractionRay).
This is my Interactable.h file:
#pragma once
#include "CoreMinimal.h"
#include "UObject/Interface.h"
#include "Interactable.generated.h"
UINTERFACE(BlueprintType)
class UInteractable : public UInterface
{
GENERATED_BODY()
};
class SPACEGAME_API IInteractable
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
UUserWidget* GetWidget();
};
And this is my InteractionRay.h file:
#pragma once
#include "CoreMinimal.h"
#include "Components/SceneComponent.h"
#include "InteractionRay.generated.h"
class IInteractable;
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class SPACEGAME_API UInteractionRay : public USceneComponent
{
GENERATED_BODY()
public:
UInteractionRay();
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
protected:
virtual void BeginPlay() override;
UPROPERTY(EditDefaultsOnly)
float RayLength;
IInteractable* CurrentTarget = nullptr;
IInteractable* GetInteractableActor();
UFUNCTION(BlueprintImplementableEvent)
void OnStartedLookingAt(IInteractable* Target);
};
When I try to compile I get this error:
Surprisingly, when I change the parameter in OnStartedLookingAt function to some other type for example AActor*, it compiles successfully.
I tried searching for answers but without success and I’m out of ideas. I would appreciate any help.