Camera rotation snapping OnTriggerEnter & Exit?

I call a bool from another script, and it allows for me to have different mouse movement than normal/default movement, so that I can clamp my left - right mouse movement. I’m basically entering a vehicle-type object, and I should not be able to look left and right beyond the initial rotation/position the moment I enter the trigger.

However, both when I enter and exit the trigger, my camera snaps to either global direction, so 0 degrees on the y-axis, or it will snap to my yRotation clamp value (35f).

I believe that the issue is coming from the yRotation variable in the transform.eulerAngles line, but I’m not sure how to fix it.

// Update()
if (enter.isInside) //enter.cs script which contains isInside bool
{
    forward = transform.forward;
    forward.y = 0;
    forward.Normalize();

    float xMouse = Input.GetAxis("Mouse X") * sensitivity;
    float yMouse = Input.GetAxis("Mouse Y") * sensitivity;
            
    xRotation -= yMouse;
    yRotation += xMouse;

    xRotation = Mathf.Clamp(xRotation, -90f, 90f);
    yRotation = Mathf.Clamp(yRotation, -35f, 35f);

    transform.eulerAngles = new Vector3(xRotation, yRotation, 0f); 
    player.transform.Rotate(Vector3.up * xMouse);
}
else
{
    // Normal camera movement goes here
}

The code above is run inside Update() of the MouseCamera script, which is attached to my Camera. I’m also not sure if it matters or not, but my Player object is not attached to my Camera. My Camera is on its own and I use an offset to make it follow the Player around.