Is there any way to set default object’s property in c++? I’ve tried to set property value but it doesn’t saved.
I want to set property values of bp class derived from my cpp class. And I’ve set one property value when other property changed in PostEditChange.
It changes value directly but it can’t be saved. When I save and close editor, reopen it, those property values I set was cleared.
Property values saved form editor directly were saved fine, but only edited from code was cleared.
Struct Codes
USTRUCT(Blueprintable)
struct FCanvasSlotData
{
GENERATED_USTRUCT_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite) FAnchors Anchors;
UPROPERTY(EditAnywhere, BlueprintReadWrite) FMargin Offset;
UPROPERTY(EditAnywhere, BlueprintReadWrite) FVector2D Alignment;
};
Code from PostEditChange()
FCanvasSlotData newSlotData;
newSlotData.Anchors = currentSlot->GetAnchors();
newSlotData.Offset = currentSlot->GetOffsets();
newSlotData.Alignment = currentSlot->GetAlignment();
FObjectEditorUtils::SetPropertyValue<UCustomCanvasPanel, FCanvasSlotData>(this, FName("LandscapeSlot"), newSlotData);