Hello! I'm new to this forum, and Unity in general, and just finished up:

https://www.3dbuzz.com/training/view...aracter-system

However, when I move the player the camera doesn't follow the player object like in the last video. I have no compile errors, and I must have missed something, but I don't know what . I changed some of the lines of code but the only one I think that may be confusing is "desPos" which is "desired position". Any help would be appreciated!

Code:
public class ThirdPersonCamera : MonoBehaviour
{
    public static ThirdPersonCamera Instance;

    public Transform TargetLookAt;
    public float Distance = 5f;
    public float DistMin = 2f;
    public float DistMax = 10f;
    public float DistSmooth = 0.05f;

    public float X_MouseSens = 5f;
    public float Y_MouseSens = 5f;
    public float MouseSensWhee = 5f;

    public float Y_MinLim = -40f;
    public float Y_MaxLim = 80f;
    //smoothing vars
    public float X_Smooth = 0.05f;
    public float Y_Smooth = 0.1f;

    private float mouseX = 0f;
    private float mouseY = 0f;
    // Velocities
    private float velX = 0f;
    private float velY = 0f;
    private float velZ = 0f;

    private float DistStart = 0f;
    private float DistCalc = 0f;
    private float DistVel = 0f;

    private Vector3 position = Vector3.zero;
    private Vector3 desPos = Vector3.zero;


    private void Awake()
    {
        Instance = this;
    }

    void Start()
    {
        Distance = Mathf.Clamp(Distance, DistMin, DistMax);
        DistStart = Distance;

        Reset();
	}
	
	void LateUpdate()
    {
        if (TargetLookAt == null)
        {
            return;
        }

        PlayerInput();

        CalcPosition();

        UpdatePosition();
    }

    void PlayerInput()
    {
        var deadZone = 0.01f;

        if(Input.GetMouseButton(1))
        {
            // RMouseButton is down get mouse Axis input.
            mouseX += Input.GetAxis("Mouse X") * X_MouseSens;
            mouseY -= Input.GetAxis("Mouse Y") * Y_MouseSens;
        }


        // Clamp/limit mouse Y rotation
        mouseY = Helper.ClampAng(mouseY, Y_MinLim, Y_MaxLim);

        if(Input.GetAxis("Mouse ScrollWheel")< -deadZone || Input.GetAxis("Mouse ScrollWheel") > deadZone)
        {
            DistCalc = Mathf.Clamp(Distance - Input.GetAxis("Mouse ScrollWheel") * MouseSensWhee, DistMin, DistMax);
        }


    }
    
    void CalcPosition()
    {
        // Evaluate distance
        Distance = Mathf.SmoothDamp(Distance, DistCalc, ref DistVel, DistSmooth);
        
        // Calc new postion
        desPos = CalculatePos(mouseY, mouseX, Distance);
    }

    Vector3 CalculatePos(float rotationX, float rotationY, float distance)
    {
        Vector3 direction = new Vector3(0, 0, -distance);
        Quaternion rotation = Quaternion.Euler(rotationX, rotationY, 0);

        return TargetLookAt.position + rotation * direction;


    }

    void UpdatePosition()
    {
        var posX = Mathf.SmoothDamp(position.x, desPos.x, ref velX, X_Smooth);
        var posY = Mathf.SmoothDamp(position.y, desPos.y, ref velY, Y_Smooth);
        var posZ = Mathf.SmoothDamp(position.z, desPos.z, ref velZ, X_Smooth);

        position = new Vector3(posX, posY, posZ);

        transform.position = position;

        transform.LookAt(TargetLookAt);
    }

    private void Reset()
    {
        mouseX = 0f;
        mouseY = 10f;

        Distance = DistStart;
        DistCalc = Distance;
    }

    public static void ExistingOrCreateNewCamera()
    {
        GameObject tempCamera;
        GameObject targetLookAt;
        ThirdPersonCamera myCamera;

        //does camera exist, else create a new one.
        if(Camera.main != null)
        {
            tempCamera = Camera.main.gameObject;
        }
        else
        {
                //Creates new game object called "Main Camera"
            tempCamera = new GameObject("Main Camera");
                //Makes the game object a camera.
            tempCamera.AddComponent<Camera>();
                //Tags the game object as "MainCamera"
            tempCamera.tag = "MainCamera";
        }

        tempCamera.AddComponent<ThirdPersonCamera>();
        myCamera = tempCamera.GetComponent("ThirdPersonCamera") as ThirdPersonCamera;

        targetLookAt = GameObject.Find("targetLookAT") as GameObject;
        
            //If targetLookAt doesnt exist, create it and zero its postion.
        if(targetLookAt == null)
        {
            targetLookAt = new GameObject("targetLookAt");
            targetLookAt.transform.position = Vector3.zero;
        }

        myCamera.TargetLookAt = targetLookAt.transform;

    }
}