Input Axis Mouse X is not Setup

Hey I have my code exactly like yours and I am getting this error.

ArgumentException: Input Axis MouseX is not setup.
To change the input settings use: Edit -> Project Settings -> Input
CameraRotation.Update () (at Assets/Scripts/CameraRotation.cs:15)

Here is my the code I copied

using UnityEngine;
using System.Collections;

public class CameraRotation : MonoBehaviour {
    
	// Use this for initialization
	void Start () {
        
	
	}
	
	// Update is called once per frame
	void Update () {

        float mouseX = Input.GetAxis("MouseX");
        transform.rotation =  Quaternion.Euler(0, mouseX, 0) * transform.rotation;
        
            
    }
}

Second line of your error message is the clue;

To change the input settings use: Edit -> Project Settings -> Input

Yours may be set up differently, but notice the space in the name of this axis.


See also;

Oh my god you’re right. I kept looking at the inputs window and I wasn’t seeing the difference in the names!

1 Like

It happens… especially if you have been looking at something for quite a while… :slight_smile:

Glad you have it sorted anyway :slight_smile:

1 Like

thanks bro i had same problem