# GENERATED\_BODY() macro

**URL:** <https://forums.unrealengine.com/t/generated-body-macro/360146>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [June 9, 2016, 7:20am UTC](https://forums.unrealengine.com/t/generated-body-macro/360146 "2016-06-09T07:20:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pelangi](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pelangi](https://forums.unrealengine.com/u/Pelangi)\
**Post date:** [June 9, 2016, 7:20am UTC](https://forums.unrealengine.com/t/generated-body-macro/360146/1 "2016-06-09T07:20:01Z")

</div>

I saw this statement in [UObject Instance Creation | Unreal Engine Documentation](https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Objects/index.html)

 ![93926-ue4+docs.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/0/3/a0346c40e717d95ce101117e7e3fce4f45883217.jpeg)

I then created a C++ project from the “block template” project. In my PlayerController header file, I made something like this:

 ![93927-compilation.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/f/2/5f2052a4e7d418a6594c9d35bf4ae56809ad0cf1.jpeg)

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?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [June 9, 2016, 1:52pm UTC](https://forums.unrealengine.com/t/generated-body-macro/360146/2 "2016-06-09T13:52:54Z")

</div>

Hey Pelangi-

The previous macro in place of GENERATED\_BODY was GENERATED\_UCLASS\_BODY(). This macro did give public access to variables by default. It appears that the documentation was not updated when the switch to GENERATED\_BODY was made. Thank you for pointing this out, I have entered a ticket to update the documentation. As for the code, GENERATED\_BODY() has private access by default, so you would need to add `public:` below it to give your pointers public access.

Cheers
