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.
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.
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).