Unrecognized type on UFUNCTION declaration with a struct parameter

M1RZ4
Mon, 09 May 2022 08:53:40 +0000
C++

I have a class with a function that receives a struct as parameter:

struct FMyStruct;

UCLASS()
class MYPROJECT_API UMyObject: public UObject
{
	GENERATED_BODY()

//...

protected:

    void MyFunction(const FMyStruct& MyStruct);

//...

};

The problem is that I want that function to be a UFUNCTION to be called in Blueprints but making that change gives me this error:

Unrecognized type ‘FMyStruct’ - type must be a UCLASS, USTRUCT or UENUM

My struct is declared in other file and it is an USTRUCT so I don’t know where does this error come from:

USTRUCT()
struct FMYStruct
{
	GENERATED_BODY()

public:

    UPROPERTY()
    float Var;

//...
};

Any ideas?

2 posts - 2 participants