ArgumentException: Input Axis is not setup
ArgumentException: Input Axis X is not setup.
Input.GetAxis and Input.GetButton look up their argument in the legacy Input Manager. The name you passed is not in its list, usually because of a typo such as "Horizantal".
Read the Console line first
X is the axis name your code asked for. The message may point you to Edit > Settings > Input; in current versions the list is in Edit > Project Settings > Input Manager.
Common causes
The axis name is misspelled
Default axes include Horizontal, Vertical, Fire1, Jump and Mouse X. Names are case-sensitive and must match exactly.
The project defines its own axes
Projects created from some templates or packages ship a different Input Manager list. Add the axis your script needs.
The fix
// Names must match Edit > Project Settings > Input Manager exactly
float x = Input.GetAxis("Horizontal");
bool jump = Input.GetButtonDown("Jump");Stop it coming back
Keep axis names as constants, or move to the Input System package, where actions are assets you reference instead of strings.
Questions
- What are Unity's default axis names?
- Horizontal, Vertical, Fire1, Fire2, Fire3, Jump, Mouse X, Mouse Y, Mouse ScrollWheel, Submit and Cancel. You can see and edit them in Project Settings > Input Manager.
- A new Unity 6 project throws a different input error. Is it related?
- Yes. New Unity 6 projects disable the legacy Input class entirely, so
Input.GetAxisthrows an InvalidOperationException before it ever looks up an axis. See the legacy Input page to enable it or move to the Input System. - How do I avoid typos in axis names?
- Keep the names as constants, such as
const string Horizontal = "Horizontal";, and use them everywhere. A typo then breaks one line you can find, not many.
Upgrading to Unity 6?
This error can also come from an API Unity 6 changed. InvalidOperationException: You are trying to read Input using the UnityEngine.Input class.
Scripts that avoid it
Related errors
Got a different error? Paste it into the error lookup.