Hi, i’m getting “Unrecognized type ‘FRandomStruct’ - type must be a UCLASS, USTRUCT or UENUM” error when I try to use a struct from another class in an interface function.
Interface.h
#pragma once
#include "CoreMinimal.h"
#include "UObject/Interface.h"
#include "InventoryInterface.generated.h"
struct FRandomStruct;
UINTERFACE(MinimalAPI)
class UInventoryInterface : public UInterface
{
GENERATED_BODY()
};
class INVENTORY_API IInventoryInterface
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintImplementableEvent, BlueprintCallable)
void OnSlotChanged(FRandomStruct& SlotInfos); //// Line throwing the error
};
[Class declaring the struct].h
[...]
USTRUCT(BlueprintType)
struct FRandomStruct
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int test;
};
[...]
I tried to forward declare (still getting the error) and to include the file containing the struct (throw “Circular dependency” error).
Is there a specific method to use a struct from another class inside an Interface?