Enabling capsule shadows from C++ is worse than from Blueprints

Hello,
I am trying to get capsule shadows working for components created in C++, however the FPS and GPU stat tell me that I must be doing something wrong because the performance is much worse than when created in Blueprints.

I use an AddSkeletalMeshComponent node in Blueprints and these are the light settings:

These are the gpu stats:

The scene is using capsule shadows exclusively. However when I create skeletal mesh components on the same actor using this C++ code the performance is worse:

	FName NewName = MakeUniqueObjectName(this, USkeletalMeshComponent::StaticClass(), SkeletalMesh->GetFName());
	auto Template = Cast<USkeletalMeshComponent>(USkeletalMeshComponent::StaticClass()->GetDefaultObject());
	auto NewSkeletalMeshComponent = Cast<USkeletalMeshComponent>(CreateComponentFromTemplate(Template, NewName));

	//New component was not created
	if (!NewSkeletalMeshComponent)
	{
		return;
	}

	//Set default values and put to sleep for better performance
	NewSkeletalMeshComponent->SetSkeletalMesh(SkeletalMesh);
	BlueprintCreatedComponents.Add(NewSkeletalMeshComponent);
	NewSkeletalMeshComponent->CreationMethod = EComponentCreationMethod::Instance;

	NewSkeletalMeshComponent->OnComponentCreated();
	NewSkeletalMeshComponent->SetupAttachment(RootComponent);
	if (NewSkeletalMeshComponent->bAutoRegister)
	{
		NewSkeletalMeshComponent->RegisterComponent();
	}

	NewSkeletalMeshComponent->SetRelativeTransform(RelativeTransform);

	NewSkeletalMeshComponent->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
	NewSkeletalMeshComponent->SetCollisionProfileName("InteractiveFoliage");
	NewSkeletalMeshComponent->SetSimulatePhysics(true);
	NewSkeletalMeshComponent->PutAllRigidBodiesToSleep();
	NewSkeletalMeshComponent->SetCastCapsuleDirectShadow(true);
	NewSkeletalMeshComponent->bSingleSampleShadowFromStationaryLights = true;

Suddenly there aren’t only capsule shadows anymore but other shadow passes as well:

I am not sure what I am doing wrong. I tried to go through every possible setting but using C++ I always end up with extra passes that drop performance :confused:

Kind Regards