I saw this statement in UObject Instance Creation | Unreal Engine Documentation
I then created a C++ project from the “block template” project. In my PlayerController header file, I made something like this:
The following statement does not have access specifiers (private/protected/public).
UPROPERTY(BlueprintReadWrite, EditAnywhere)
UTexture2D* mCustomTexture;
But based on the documentation, the GENERATED_BODY()
macro should give public
access specifiers to all member variables by default. Oddly, when I compile the project in VS, it showed this error:
BlueprintReadWrite should not be used on private members
I thought that member variable should be public
by default because there’s the GENERATED_BODY()
macro. Is this a bug in UE4?
Could you explain why the macro and the compiler does not sync?