Hi! I’m trying out interfaces in Unreal c++ and seeing what I can do with them.
My setup right now is really simple:
I have a blueprint class: TemporaryBlueprint
TemporaryBlueprint is a child of ATemporaryActor (c++ class)
ATemporaryActor is a child of Actor, and IMyInterface (c++ class)
MyInterface.h
#pragma once
#include "CoreMinimal.h"
#include "UObject/Interface.h"
#include "MyInterface.generated.h"
// This class does not need to be modified.
UINTERFACE(MinimalAPI)
class UMyInterface : public UInterface
{
GENERATED_BODY()
};
/**
*
*/
class DEVSPACE_API IMyInterface
{
GENERATED_BODY()
// Add interface functions to this class. This is the class that will be inherited to implement this interface.
public:
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "From|Interface")
bool TestEvent();
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "From|Interface", meta = (AllowPrivateAccess = "true"))
bool InterfaceVariable;
};
TemporaryActor.h:
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "MyInterface.h"
#include "TemporaryActor.generated.h"
UCLASS()
class DEVSPACE_API ATemporaryActor : public AActor, public IMyInterface
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ATemporaryActor();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
protected:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "From|Child", meta = (AllowPrivateAccess = "true"))
bool abcd;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "From|Child", meta = (AllowPrivateAccess = "true"))
bool efgh;
};
The blueprint class does show every variable from ATemporaryActor, but not from IMyInterface.
Is this impossible, or am I missing something?