I’ve created a custom UserWidget subclass with some convenient functions. One of them is SetChildTextFont, which is a CallInEditor function designed to batch set the font for all TextBlock widgets. It works fine in the editor, but the font changes do not persist after closing the editor or compiling. I’ve tried using MarkPackageDirty and PostEditChangeProperty, but neither worked. Does anyone know how to make these changes persist?

void UBetterUserWidget::SetChildTextFont()
{
if(ChildTextFont.HasValidFont())
{
FProperty* FontProperty = UTextBlock::StaticClass()->FindPropertyByName(TEXT("Font"));
TArray<UTextBlock*> AllTextBlocks;
GetAllChildByClass<UTextBlock>(UTextBlock::StaticClass(),AllTextBlocks);
for (auto TextBlock : AllTextBlocks)
{
TextBlock->SetFont(ChildTextFont);
FPropertyChangedEvent PropertyChangedEvent (FontProperty,EPropertyChangeType::ValueSet);
TextBlock->MarkPackageDirty();
TextBlock->PostEditChangeProperty(PropertyChangedEvent);
}
if (UWorld* World = GetWorld())
{
if (World->IsEditorWorld())
{
UPackage* Package = GetOuter()->GetOutermost();
Package->MarkPackageDirty();
TArray<UPackage*> PackagesToSave = { Package};
FEditorFileUtils::PromptForCheckoutAndSave(PackagesToSave, true, false, nullptr, false, true);
}
}
}
}