How to annotate a UPROPERTY with units (eg centimeters, newtons, etc) so it will display in editor?

You can tell unreal to display units in the editor, under the Project Settings > Editor > Appearance:

[/Script/UnrealEd.EditorProjectAppearanceSettings]
bDisplayUnits=True

How do I annotate a visible UPROPERTY in C++:

UPROPERTY(VisibleAnywhere, ThisIsInCentimeters???)
double SwordLength;

so that it will display the correct unit in the editor? (I tried to track down an example, but I don’t know what to search for.)

Hi zos,
You can use the meta “Units” property:

UPROPERTY(EditAnywhere, meta=(Units="Centimeters"))

FYI there’s a good list of the UProperties here:

2 Likes