Is there a detailed description of C++ Macros?

Is there a place where I can read up about all of the Macros in C++ in UE, such as UCLASS(), UPROPERTY(), UFUNCTION(), etc… (I dont know how many there are)

AND I can find a description of all of the possible arguments they take, their benefits and when to use them?

Most tutorials I find say things like “you should only set it to VisibleAnywhere because that’s the ‘best’”. Well, thanks for the objective information…

Anyhow, I would be happy to deep-dive into Macros, e̶v̶e̶n̶ ̶i̶f̶ ̶i̶t̶’̶s̶ especially if it’s long, boring documentation! :slight_smile:

there is the documentation:

and

but these can be rather lacking and are often just copy and past from the ObjectMacros.h
found at …\Engine\Source\Runtime\CoreUObject\Public\UObject\ObjectMacros.h (you can also get there by in VS right click any of the macro specifiers like EditAnywhere and selecting Go To Definition)

another good resource would be

just keep in mind that it hasn’t been updated in a while but the macro specifiers are kind of less likely to change.

1 Like

the “everything should be VisibleAnywhere” sounds like bad advice (like almost any “you should always do X” statements)
the differences between the visibility/Editability settings (keep in mind you only get one of these for each property):

VisibleAnywhere:
it will be a greyed out box at all times the value can be read, but never manipulated in the outliner/detailsWindow, mostly use this if the value is purely driven through code be it C++ or Blueprints through BlueprintReadWrite
EditAnywhere:
It can be modified anywhere in the outliner/DetailsWindow whether that be in the blueprint, or in the level. keep in mind changes made in the Level will not apply back to the Blueprint, and changes made in the Blueprint may not propagate to the instances especially if the value was changed in the instance.
VisibleInstanceOnly:
this value will only ever show up in the Level Outliner/DetailsWindow and it will be greyed out. this is probably the most useless of all the visibility/Editability specifiers unless you only ever want to examine what it is during runtime at that is it and trust the value at all other times or the value has not significance until runtime, but then it shows up in the level Editor anyways.
EditInstanceOnly:
this value will only ever show up in the Level Outliner/DetailsWindow but it will be editable. this has value for say checking damage values, or say jump heights of this specific instance of the entity.
EditDefaultsOnly:
this value will only Show up and be editable in the Blueprint, sometimes the Engine will still show you the value in the Level, or another Blueprint but if it does do not save changes to that, or the Engine is very likely to crash. think of this as a protected for the Blueprint where the Instance is kind of a composition step.
VisibleDefaultsOnly:
this will only show up in the Blueprints, but again this is not not editable, so it is either controlled by C++/Bleuprints, but should not show up in the level editor.

there is also like EditInlineNew but I personally haven’t had that much of a positive experience with this modifier, so I can’t comment to much on it.