C++ generated components spawn in world space?

I’m having a very weird bug that I’ve battled with for a few days now. I’m trying to create a system where players can enter and exit vehicles, so my vehicle class has a BoxComponent that is used for overlap events to know when the player is close enough to enter the vehicle. Here is my code:

AWheeledVehicleBase::AWheeledVehicleBase()
{
	DriverSeatTrigger = CreateDefaultSubobject<UBoxComponent>("DriverSeatTrigger");
	HealthComp = CreateDefaultSubobject<UHealthComponent>("HealthComponent");
}

void AWheeledVehicleBase::BeginPlay()
{
	Super::BeginPlay();

	if (!DriverSeatTrigger)
	{
		UE_LOG(LogTemp, Error, TEXT("No DriverSeatTrigger assigned on %s!"), *(GetName()));
		return;
	}

	DriverSeatTrigger->SetupAttachment(RootComponent);
}

I then have a blueprint class that inherits from AWheeledVehicleBase, where I adjust the location of the BoxComponent “DriverSeatTrigger” to be near the driver’s door. The issue I am having is that when I drag an instance of the vehicle into the scene, the BoxComponent spawns at the origin of the world instead of where it is in the blueprint. The weird thing is that I can “reset” the location of the BoxComponent on the vehicle instance in the world and it will snap to where it’s supposed to be. Here’s a picture of what’s happening:

You can see the BoxComponent located at (1.) at the origin of the world and when I click the reset button at (2.) the BoxComponent snaps to where it should be relative to the vehicle near the driver’s door as shown in the blueprint. Any ideas of what’s going on here would be greatly appreciated!

Thank you!

If RootComponent has already been set, then change the constructor to this:

 AWheeledVehicleBase::AWheeledVehicleBase()
 {
     DriverSeatTrigger = CreateDefaultSubobject<UBoxComponent>("DriverSeatTrigger");
     DriverSeatTrigger->SetupAttachment(RootComponent);

     HealthComp = CreateDefaultSubobject<UHealthComponent>("HealthComponent");
 }