ArgumentException: Input Axis horizontal is not setup.

No matter what I do I cannot get this error to go away, I have checked spelling. Listed below is my current script. I am new to using C# so I may just be making a noob mistake that I cannot see

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

public class RubyController : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{

}

// Update is called once per frame
void Update()
{
float horizontal = Input.GetAxis(“Horizontal”);
Debug.Log(horizontal);
Vector2 position = transform.position;
position.x = position.x + 0.1f * horizontal;
transform.position = position;
}
}

If the error message in your title is correct, you have misspelled “Horizontal” as “horizontal” somewhere. It might be in a different script than the one you’ve posted. If you check that full error message (click on it in the console) it should show you which file the error is happening in and on which line number. Additionally you should be able to double click the error and it should take you directly to the problem.

6 Likes

Thank you random internet stranger from 3 years ago! I did not know it would direct to the specific error if you clicked on the error message!

1 Like