GetAxis not detecting keyboard input

I’m following unity’s Create with Code tutorial, and am currently try to move the truck through player input. Neither Visual Studio nor Unity are giving me any errors or warnings. I have made sure to go into project settings and set input type to key or mouse button.

Here is my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FollowPlayer : MonoBehaviour { 
    public GameObject player;
    public Vector3 offset = new Vector3(0, 5, -7);   
    public float turnspeed;
    public float horizontalInput;


    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {

        horizontalInput = Input.GetAxis("Horizontal");

        transform.position = player.transform.position + offset;
        transform.Translate(Vector3.right * Time.deltaTime * turnspeed * horizontalInput);
    }
}

,

You’re merging your follow player script and player controller script, you’ve put the input code in the follow player so what I imagine is that the code is currently trying to move the camera instead of the car. I suggest restarting the tutorial if you haven’t to try to get a better understanding. :slight_smile: