Do you guys know what is wrong with the code, it says error "expected"

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MouseMovement : MonoBehaviour
{

public float mouseSensitivity = 100f;

float xRotation = 0f;
float YRotation = 0f;

void Start()
{
  //Locking the cursor to the middle of the screen and making it invisible
  Cursor.lockState = CursorLockMode.Locked;
}

void Update()
{
   float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
   float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;

   //control rotation around x axis (Look up and down)
   xRotation -= mouseY;

   //we clamp the rotation so we cant Over-rotate (like in real life)
   xRotation = Mathf.Clamp(xRotation, -90f, 90f);

   //control rotation around y axis (Look up and down)
   YRotation += mouseX;

   //applying both rotations
   transform.localRotation = Quaternion.Euler(xRotation, YRotation, 0f);

}

}

is the error on this line? if not, which line, what is the full error?

Well your code pasted here is terribly badly formatted, the title was the only hint at the error, so, OK its saying line 6 position 2… so, it either means something wonky line 5, or actually exactly where it says line 6.

Try editing that original post of code, so its all in code tags, so we can all see clearly as lots of things outside code tags dont work…

I’ll try and give you a result

Note: this is really old-school way of programming in Unity and I can already see a forthcoming use of Camera.main to script camera behaviour. You don’t need any of this!

Controlling camera with the new Input system is implemented with Cinemachine. It’s practically drag & drop.

You can base your work off of a working First Person or Third Person starter asset sample project utilizing Cinemachine and Input System.

Even if it’s just a learning experience, it’s better to learn the modern way of doing things. It’s both more efficient and more useful for making either games or a career or both. :wink: