Camera spawning far away from placed pawn

Hi Guys, I’m very new to coding in Unreal, so forgive me if this is a simple problem, but I have searched for so long trying to figure out why this is happening.
When I place my Pawn in the world, the camera component spawns far away from it. Below are my cpp and h files

Additionally, if I try to create a BP that inherits from this C++ class, the camera component has no transform and acts strangely when I try to place the bp in the world (EX: the camera spawns in front of the mesh, even if I explicitly set it to be behind it)

I am willing to provide any additional code and pictures. Thanks!


At first glance, this seems to be an attachment issue. Every scene component you create on an Actor must be attached to something else.
Sometimes attaching components to the default root component isn’t sufficient, so I usually create my own root components. In this case it would make sense to have your Pawn’s collision component to be the root, but if you don’t want that, your actual Pawn mesh should be fine too.

EDIT: I usually also call Super().

AQuarantineSimPawn::AQuarantineSimPawn() :Super()
    // Set this pawn to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
    PrimaryActorTick.bCanEverTick = true;

    //The movement component isn't a scene component so it doesn't need to be attached.

    PawnMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("PawnMesh"));

   //Set the PawnMesh as the root component.

    PawnCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("PawnCamera"));