'cs0103: Unity don't understand GetAxis [closed]
I'm using Brackeys guide how to make a first person movement in unity, but unity leaves the error message "The name 'GetAxis'does not exist in the current context"
public float mouseSenitivity = 100f;
public Transform playerBody;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
float mouseX = GetAxis("Mouse X") * mouseSenitivity * Time.deltaTime;
float mouseY = GetAxis("Mouse Y") * mouseSenitivity * Time.deltaTime;
playerBody.Rotate(Vector3.up * mouseX);
Solution 1:[1]
You need to use Input.GetAxis:
float mouseX = Input.GetAxis("Mouse X") * mouseSenitivity * Time.deltaTime;
float mouseY = Input.GetAxis("Mouse Y") * mouseSenitivity * Time.deltaTime;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | HardSource |
