My camera follow works fine in scene view, but not in game view.

The camera follows the player perfectly in scene view and the position updates in the inspector as the player moves. But in game view, I can't move my player.
Here's my CameraFollow script for reference:

using UnityEngine;

public class CameraFollow : MonoBehaviour
    public Transform player;
    public float smoothSpeed = 0.125f;
    public Vector3 offset;

    private void LateUpdate()
        Vector3 desiredPosition =this.gameObject.transform.position = player.position + offset;
        Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed);
        transform.position = smoothedPosition;

And here's a video if you want to see the editor side of the error:

You have a completely solid background, and the camera is moving with the player. So when the player moves (and the camera with it), how do you expect to see it in the Game view? For a camera like this, you need to have a background in which you can actually notice the player moving in front of. Or put other objects in the scene so you can see the player moving relatively to those objects.

1 Like

Can you elaborate, please?

I’m not sure how to be more clear. When humans perceive motion it is because the object is moving relative to something else. You’ve got nothing else in the scene, and you’re moving the camera in lock step with the player. So it is not possible to perceive its motion. Put some other stuff in the scene and retest.

Just think about this for a moment. You have a completely solid gray scene. The only thing visible is the player object. You then move both the player and camera objects 5 units to the right. What is that going to look like with your completely solid gray background and nothing else? It will look exactly like the object hasn’t moved at all even though it has moved.

1 Like

The only error was in my brain.

1 Like