Im new to UE4 and am trying to get around to seeing what certain things do but there inst a lot of documentation for stuff like this, so i was wondering if someone could give me a hand and start with explaining what these do

Those macro pastes code generated by UnrealHeaderTool (UHT) contained in HeaderFileName.generated.h to class or struct deceleration, it is required for UObject to properly function. It’s primerly for reflection system, UHT maps your class and generate registration code, so you don’t need to register class, properties and and functions to that system, UHT prepares that for you + it includes helpful functions like StaticClass() which you probably already meet. But it can’t alter how C++ compiler work and you need to paste the code that it prepares via that macro to your class.

In C++ you can’t read structure of you code after compilation, everything is turned in to numbers and addresses, so application it self it need to implement so called reflection system in order to see it’s classes, properties and functions, to see it’s own reflection, like animal having ability to recognize it self in reflection, like name suggests and this is what UE4 and UHT provides. This way for example editor see all classes, properties and nodes based from C++. You can use it in game too to create auto discovery of actor classes and there properties, create smart UI so you don’t need to make new UI for each thing.

The link provided by ali explains the diffrence between the too, but you should use GENERATED_BODY() as other one is old method, it’s still being keeped alive as some of engine code still didn’t switch to new macro.

1 Like