I am following a tutorial by Brackeys (Youtube) with link
I was around 9 minutes in and I copied it word for word and it still doesn’t work
In my console it says:
Assets/MouseLook.cs(23,44): error CS1003: Syntax error, ‘,’ expected
Assets/MouseLook.cs(24,44): error CS1003: Syntax error, ‘,’ expected
When it is with quotes around the ‘Mouse X’ and the ‘Mouse Y’ it doesn’t work.
Here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseLook : MonoBehaviour
{
public float mouseSensitivity = 100f;
public Transform playerBody;
float xRotation = 0f;
// Start is called before the first frame update
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
}
// Update is called once per frame
void Update()
{
float mouseX = Input.GetAxis(Mouse X) * mouseSensitivity * Time.deltaTime;
float mouseY = Input.GetAxis(Mouse Y) * mouseSensitivity * Time.deltaTime;
xRotation -= mouseY;
xRotation = Mathf.Clamp(xRotation, -90f, 90f);
transform.localRotation = Quaternion.Euler(xRotation, of, of);
playerBody.Rotate(Vector3.up * mouseX);