.cpp

//Add this code to your Actor or whatever class constructor.
 
#if WITH_EDITOR
#define LOCTEXT_NAMESPACE "Custom Detail"
static const FName PropertyEditor("PropertyEditor");
FPropertyEditorModule& PropertyModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>(PropertyEditor);
 
//Change "Actor" for the type of your Class(eg. Actor, Pawn, CharacterMovementComponent)
//Change "MySection" to the name of Desired Section
TSharedRef<FPropertySection> Section = PropertyModule.FindOrCreateSection("Actor", "MySection", LOCTEXT("MySection", "MySection"));
 
//You can add multiples categories to be tracked by this section
Section->AddCategory("MyCategory");
#undef LOCTEXT_NAMESPACE
#endif

.h

// Now declare your variable normally, but use the Category with exactly what you defined on
// the track (Section->AddCategory("MyCategory");)
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MyCategory")
int32 MyVariable;