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