How can I have a mutable UPROPERTY()?

It seems like UnrealHeaderTool doesn’t like mutable properties:

UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Transient, AdvancedDisplay, Category = "Missile|Debug")
	FVector mutable Movement;

Building this, I get an error:

2>C:/Users/jwatte/Documents/Unreal Projects/TwinStickTemplate/Source/TwinStickTemplate/Public/MissileMovementComponent.h(36): error : Missing ';' in 'variable declaration'

Removing the “mutable” resolves the error.

How can I declare mutable member variables as UPROPERTY() ?

1 Like

Should’t mutable be before variable type? It works for me. Also mutable is a strange thing in c++ and can be put practically anywhere inside a c++ code, so it complies from a compiler perspective but fails from a uht.

Mutable before the variable type works, but that’s not how it “should” be – C++ allows cv-quals in either location, and because declarations are read inner-to-outer, right-then-left, the natural place to put them is between the type and the name (at least if you’re a C programmer.)
Going against that convention did make it work, though!