Normally, the Details Panel rebuilds itself only when you select an object. This means that if you use edit conditions to add, hide, or skip adding a field in a Details Panel customization, the Details Panel updates even when you change the variables used in your edit condition. Instead, the Details Panel updates when you de-select and re-select the object.
To update the Details Panel manually, add a delegate that calls IDetailLayoutBuilder::ForceRefreshDetails to any properties that you want to trigger an update. This tutorial provides a on how to create this kind of delegate.
This tutorial builds on the code from the Details Panel Quickstart.
Steps
Follow these steps to create a reusable delegate for refreshing Details:
-
Set up your delegate to call
IDetailLayoutBuilder::ForceRefreshDetails. The following is a simple lambda function delegate you can put inline in yourCustomizeDetailsfunction and reuse for all properties you want to cause a refresh:CustomClassDetailsCustomization.cpp
const FSimpleDelegate OnValueChanged = FSimpleDelegate::CreateLambda([&DetailBuilder]() { DetailBuilder.ForceRefreshDetails(); }); -
Use
IDetailLayoutBuilder::GetPropertyto get a TSharedRefpointing at your property. CustomClassDetailsCustomization.cpp
TSharedRef<IPropertyHandle> boolPropertyHandle = DetailBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(ACustomActor, CustomBool)); -
Use
IPropertyHandle::SetOnPropertyValueChangedto assign your delegate and force the details panel to refresh anytime that property is changed.CustomClassDetailsCustomization.cpp
boolProperty->SetOnPropertyValueChanged(OnValueChanged);
With this change, any changes to the CustomBool field causes the Details Panel to refresh.