[Help] Details Customization not working for USTRUCT

Hey guys,
I have been trying to get Details Customization to work for a USTRUCT. So far I’ve followed this guide for creating an EditorModule and this guide for customizing the details panel.
It compiles and the EditorModule prints logs, so that is working.

However, the customization does not print the log I’ve put in CustomizeHeader.
The struct I’m trying to customize(FWeaponDataTableRow) is inside my game module, while the customization is inside the EditorModule.

I’ve been trying to get it to work all day, does anybody have any ideas?

EditorModule code:


void FMyGameEditorModule::StartupModule()
{
    UE_LOG( MyGameEditor, Warning, TEXT( "MyGameEditor: Log Started" ) );

    FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>( "PropertyEditor" );
    PropertyModule.RegisterCustomPropertyTypeLayout( "WeaponDataTableRow", FOnGetPropertyTypeCustomizationInstance::CreateStatic( &FWeaponDataTableRowCustomization::MakeInstance ) );

    PropertyModule.NotifyCustomizationModuleChanged();
}

Customization header:


class FWeaponDataTableRowCustomization : public IPropertyTypeCustomization
{
public:
    static TSharedRef<IPropertyTypeCustomization> MakeInstance();

    virtual void CustomizeHeader( TSharedRef<IPropertyHandle> PropertyHandle, FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& CustomizationUtils ) override;
    virtual void CustomizeChildren( TSharedRef<IPropertyHandle> PropertyHandle, IDetailChildrenBuilder& ChildBuilder, IPropertyTypeCustomizationUtils& CustomizationUtils ) override;

private:
    TSharedPtr<IPropertyHandle> TestHandle;
    // property handles
};

Customization cpp:



#define LOCTEXT_NAMESPACE "WeaponDataTableRowCustomization"

TSharedRef<IPropertyTypeCustomization> FWeaponDataTableRowCustomization::MakeInstance()
{
    return MakeShareable( new FWeaponDataTableRowCustomization() );
}

void FWeaponDataTableRowCustomization::CustomizeHeader( TSharedRef<IPropertyHandle> PropertyHandle, FDetailWidgetRow & HeaderRow, IPropertyTypeCustomizationUtils & CustomizationUtils )
{
    UE_LOG( LogTemp, Error, TEXT( "Customization Registered!" ) );
}

void FWeaponDataTableRowCustomization::CustomizeChildren( TSharedRef<IPropertyHandle> PropertyHandle, IDetailChildrenBuilder & ChildBuilder, IPropertyTypeCustomizationUtils & CustomizationUtils )
{
}

#undef LOCTEXT_NAMESPACE

I notice you said youre trying to customize a table row, which would indicate you’re using this with Data Tables?

It could be that the Data Table editor doesn’t allow customizations or check for customizations, or the existing FDataTableRow customization overrides it. Have you tried creating a variable of type ‘FWeaponDataTableRow’ just as a member of a normal class, like an actor, to see if it uses the customization then?

Thanks for the reply!
I tried using a USTRUCT which wasn’t a table row struct, but it still didn’t log the UE_LOG inside CustomizeHeader. Also, it seems like it never actually creates the customization(the static MakeInstance is never called).
I tried to debug the RegisterCustomPropertyTypeLayout with breakpoints, but I can’t because it says that “Symbols are not loaded for that document”.

Oh, I was wrong, it actually works with a normal USTRUCT, I was just doing it incorrectly.
For whoever needs it - it DOES NOT work with datatable row structs. However, you can create another USTRUCT to use inside the row struct which can be fully customized. That’s how I solved my problem.