Input Axis Mouse x is not setup

using UnityEngine;
using System.Collections;

public class NewBehaviourScript : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	     float delta_x = Input.GetAxis("Mouse X");
		 float delta_y = Input.GetAxis("Mouse Y");
		
		transform.position = new Vector3(transform.position.x + delta_x, transform.position.y + delta_y, 0); 
			
	}
}

I tryed this code out but I keep getting this error

UnityException: Input Axis Mouse x is not setup.
 To change the input settings use: Edit -> Project Settings -> Input
NewBehaviourScript.Update () (at Assets/Player/NewBehaviourScript.cs:13)

The error message tells you exactly what to do.

" Edit → Project Settings → Input" this part in particular

Sorry, lol I tried it in the scripting program instead of in Unity

Hey go to Edit → Project Settings → Input and the setting as ::
Mouse X
Name : Mouse X
Gravity : 0
Dead : 0
Sensitivity : 0.1
Type : Mouse Movement
Axis : X axis
Joy Num : Get Motions from all Joysticks

3 Likes

“Mouse X” did it for me. In the Unity docs was “Horizontal”.
Thanks!

I had this issue and my fix was putting a space between ‘Mouse’ and ‘X’.
My string was wrong.
Before: ‘MouseX’
After: ‘Mouse X’

i have it setup like that but doesn´t seem to work

1 Like