How do I set Default Value for a member variable in C++?

Hi,
So, if I create a variable in BP, under Details there is the Default Value that we can specify. If this is a var that is Instance Editable, and its value is changed, a small icon appears that allows to reset it to the default value.

Zrzut ekranu 2026-04-03 152745

How do I do that in C++? To make my question clear: what do I do with the variable in C++, if I want it to have a default value and when this value is changed, I want this ‘reset to default value arrow’ icon to appear in BP.

If that matters, my C++ class variable is of a UStruct type that contains some bool as well as FSlateBrush variables. I would like these variables to have default values.

:thinking: Just specify the default value in the code (?)

UPROPERTY(BlueprintReadWrite, EditAnywhere)
int MyVar = 100500;

(post deleted by author)

Ok, so the problem possibly is that my variable is a UStruct:

USTRUCT(BlueprintType)
struct FCommonButtonStyleOverride
{
	GENERATED_BODY()

public:
	FCommonButtonStyleOverride() { bOverrideBaseNormal = false; BaseNormal = FSlateBrush();}
	
	/** Should this button override the Style's Base (not-Selected/not-Disabled) Normal (not-Hovered, not-Pressed) state */
	UPROPERTY(EditAnywhere, BlueprintReadWrite) bool bOverrideBaseNormal;
	/** The Base (not-Selected/not-Disabled) Normal (not-Hovered, not-Pressed) state brush to apply if the corresponding override is True */
	UPROPERTY(EditAnywhere, BlueprintReadWrite) FSlateBrush BaseNormal;
...

As you can see I made the constructor for the Struct (which I’m not even sure is necessary).

Then, I declared my variable like this:

UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = Style)
FCommonButtonStyleOverride StyleOverride;

I also tried like this:

UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = Style)
FCommonButtonStyleOverride StyleOverride = FCommonButtonStyleOverride();

None of these worked.
EDIT: I also tried specifying the default value in, while declaring the variable in the struct - didn’t work either.

What’s more, I tried making a simple bool variable and set it to true, when declaring it, exactly as you suggested - it doesn’t work:

UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = Style)
bool StyleOverrideBool = true;

Zrzut ekranu 2026-04-04 093550

Zrzut ekranu 2026-04-04 093626

No ‘reset to default value arrow’ icon appears, regardless if I set it to true or false.