#unreal

Plugin

I’ve created a plugin that allows you to sort the properties in the details panel by configuring it from Project Settings - If you are interested, please check out zomg’s editor addons - No C++ code required!

Manual setup

You can force categories to be sorted in a given order for actors using IDetailCustomization.

It seems only one customization can exist per class. You can add a customization for Actor, but this overrides the engine’s own customization for it and you lose some details panel features for it.

Code

class UZGDetailsCustomizer : public IDetailCustomization
{
public:
	virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override;
 
	static TSharedRef<IDetailCustomization> MakeInstance();
};
 
void UZGDetailsCustomizer::CustomizeDetails(IDetailLayoutBuilder& DetailBuilder)
{
	IDetailCategoryBuilder& SetupCategory = DetailBuilder.EditCategory("Setup");
	SetupCategory.SetSortOrder(1);
	
	IDetailCategoryBuilder& StateCategory = DetailBuilder.EditCategory("State");
	StateCategory.SetSortOrder(2);
}
 
TSharedRef<IDetailCustomization> UZGDetailsCustomizer::MakeInstance()
{
	return MakeShareable(new UZGDetailsCustomizer);
}

Register in StartupModule

FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
PropertyModule.RegisterCustomClassLayout("ShWeaponPickup", FOnGetDetailCustomizationInstance::CreateStatic(&UZGDetailsCustomizer::MakeInstance));

Unregister in ShutdownModule

FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
PropertyModule.UnregisterCustomClassLayout("ShWeaponPickup");