Camera not following my pawn properly

Hey everyone, I’m fairly new to the Unreal Engine and very new to using C++ in it, I’m still getting the hang of things. I’ve been following this tutorial but encountered a weird problem with my camera - it doesn’t follow the player at all despite being attached to it via a Spring arm, and weirdly, it’s very inconsistent between the asset view, level view, and in-game view.
Here’s the asset view: It’s attached to the player like it should be

But in the level view if I move the player around, it doesn’t follow them, it seems to be stuck to the floor

And then in game it doesn’t even show what it’s FOV is supposed to be! The camera is just looking beneath the floor. If I zoom out, it looks like it’s looking in the same direction as in the level editor, but very zoomed-in.


I only have a couple leads as to what could be happening: I thought maybe the default gamemode was messing up the camera but replacing it with my own gamemode, which has my pawn and a custom controller, didn’t fix the problem.
C++ has also been very weird generally. My player asset is a blueprint that is based on a custom C++ class like in the tutorial, and certain changes I make to it don’t get saved - like when I make the mesh a sphere. When I start up the project, the root component is a camera, but it’s supposed to be a mesh. If I recompile the project, then this is fixed.
This problem has been making it really difficult to continuing learning C++ for Unreal, so I would really appreciate any help or just suggestions of things to try out thanks!

Hello, can you show the part of the code where you manage the spring arm and the camera ? If they are editable in blueprint, can you show the details in blueprint too ?
If you want to compare, there’s some lines I made for my project. They are in my constuctor. It works for me sow maybe something can help you :

{

/* Create SpringArm for camera
* Attach to root
* Change start location and rotation relative to root location
* Change SpringArm length (Distance between root and Camera) */
SpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("Spring Arm"));
SpringArm->SetupAttachment(RootComponent);
SpringArm->SetRelativeLocationAndRotation(FVector(0.0f, 0.0f, 100.0f), FRotator(0.0f, -90.0f, 0.0f));
SpringArm->TargetArmLength = 400.f;

//Create camera attached to SpringArm
GameCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("Follow Camera"));
GameCamera->SetupAttachment(SpringArm);

}

I just have to warn you, I made this in UE4. I don’t know if it always work on UE5.
All the librairies I needed are :
GameFramework/SpringArmComponent.h and Camera/CameraComponent.h

Using hot reload / live coding? if so, don’t.

There are a few things going on in your project. FOV is as far as I know controlled by the player camera manager , which is a class you can get a reference for from the player controller. If I set the FOV there, all my cameras update.

For the camera not following your pawn: Is the camera attached to the another component? Else it will not get a relative position. Is the camera spring arm set to interpolate super super slowly?

Hey all, sorry for never replying to the suggestions you posted. I actually ended up fixing this problem on the same day I made this post.

The problem was that when opening up the project, if I also opened up my player blueprint the root component would be a camera and there was no spring arm or mesh - the properties of the camera root seemed to persist even after I recompiled the project to get the spring arm and mesh back.

However, this is how I fixed the problem: If I recompiled the project before I opened up my player blueprint, the mesh, spring arm, and camera would all be there in their correct places and the camera functioned as normal. Still, it’s really annoying to have to recompile the project every time I open it up…

At this point I’ve kind of given up trying to use C++ in Unreal for now and instead am focusing on getting stuff made quickly using blueprints. Though I’m still interested in learning what went wrong so that this fiasco can be avoided in the future.