I am new to unity but found some difficulty in understanding the code

Hello i am new to unity and trying to make a fps watching a tutorial but found it difficult to understand the code it will be very thankful if anyone can help me understanding the code.

And also there is a bit weird thing happening to my game is that after i run it the camera’s rotational x is getting set to 90.

public class MouseLook : MonoBehaviour
{
    public float sensitivity=100f;
    public Transform playerbody;
    float Xrotation=0f;

    void Start()
    {
        Cursor.lockState=CursorLockMode.Locked;
    }

    void Update()
    {
        float mouseX=Input.GetAxis("Mouse X")*sensitivity*Time.deltaTime;
        float MouseY=Input.GetAxis("Mouse Y")*sensitivity*Time.deltaTime;
        Xrotation-=MouseY;
        Xrotation=Mathf.Clamp(Xrotation,-90f,90f);
        transform.localRotation=Quaternion.Euler(Xrotation,0f,0f);
        playerbody.Rotate(Vector3.up*mouseX);
    }
}

First things first I would learn about good code style and casing as its going to help you keep your code legible.


Secondly you are setting your localRotation to probably a value above 90.0f (as you are using a 100f multiplier if the axis value is 1 then it will be a value of 100 * deltaTime) and then you are clamping it which will keep it pinned at 90. You are then setting transform.localRotation to that rotation on line 18.