How to swap components within PostEditChangeProperty

Also it´s an old Post: as your Trigger is of type UShapeComponent you first need to to Cast to the needed component type:
I tried to do exactly this and so I stumbled upon this post. I do something like this:



switch (CustomTriggerShape)
    {
        case ECustomTriggerShapes::none:
            UE_LOG(LogTemp, Log, TEXT("Do NONEThings"));
            break;
        case ECustomTriggerShapes::BoxTrigger:
            UE_LOG(LogTemp,Log, TEXT("Do BOXThings"));
            HazardTrigger = Cast<UBoxComponent>(NewObject<UBoxComponent>(this));
            break;
        case ECustomTriggerShapes::SphereTrigger:
            UE_LOG(LogTemp,Log, TEXT("Do SPHEREThings"));
            HazardTrigger = Cast<USphereComponent>(NewObject<USphereComponent>(this));
            break;
        case ECustomTriggerShapes::CapsuleTrigger:
            UE_LOG(LogTemp,Log, TEXT("Do CAPSULEThings"));
            HazardTrigger = Cast<UCapsuleComponent>(NewObject<UCapsuleComponent>(this));
            break;
    }


But the DetailsPanel itself does not Refresh this time. You need to to reselect the Object in the worldOutliner to refresh the state of the Object.