Download

using BlueprintReadWrite causes compilation error

I’ve just started getting into c++ and I am doing the Introduction to C++ Programming in UE4. I try building the code given in the tutorial and it does not compile. The BlueprintReadWrite property is causing it, as if I remove it the code compiles.


UCLASS()
class AMyActor : public AActor
{
    GENERATED_BODY()

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Damage")
    int32 TotalDamage;

    ...
};

-Other Compilation Error (5)
-error MSB3073 the command … Build.bat exited with code -1

By default all properties are Private. You need to declare it as public or protected to be able to edit it inside Blueprint like that:



UCLASS()
class AMyActor : public AActor
{
    GENERATED_BODY()

public:
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Damage")
    int32 TotalDamage;

    ...
};


Thank you, that is good to know.