UStruct UPROPERTY(BlueprintReadOnly) gives an error

I’m trying to figure out how to use ue4 and I came across this problem. When I try use ustruct I cant make any of it’s properties into UPROPERTY with a blueprintType other then BlueprintInternalUseOnly. I Tried to use BlueprintReadOnly and BlueprintReadWrite but it gives me an error.
So this one works:

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "SpaceShip.generated.h"

USTRUCT()
struct FSpaceShipInput{
    GENERATED_BODY()

    UPROPERTY(VisibleAnywhere, BlueprintInternalUseOnly, Category = "Spaceship Input")
    FVector2D MovementInput;
    
    void Sanitize();
    void MoveX(float AxisValue);
    void MoveY(float AxisValue);

private:
    FVector2D RawMovementInput;
};

but if I change UPROPERTY(VisibleAnywhere, BlueprintInternalUseOnly, Category = “Spaceship Input”)
to UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = “Spaceship Input”) and try to compile the editor would generate the following error:
LogCompile: Error: Cannot expose property to blueprints in a struct that is not a BlueprintType. SpaceShipInput.MovementInput

In your USTRUCT macro, put in BlueprintType. That should work. So USTRUCT(BlueprintType)

1 Like

Awesome. It finally works. Thanks

Note that the error message is “Cannot expose property to blueprints in a struct that is not a BlueprintType.”. Just putting that out so this comes up in search engines.

solved also this compile log error for me

LogCompile: Error: Type '' is not supported by blueprint.

Thx