Limit mouse look view

Hi everyone,
The x-axis limit does not work, but the y-axis limits are works. How can fix this?

My codes:

public class MouseLook : MonoBehaviour
    public float speedH = 2.0f;
    public float speedV = 2.0f;

    public float minimumX = 0F;
    public float maximumX = 10F;
    public float minimumY = -30F;
    public float maximumY = 30F;

    private float yaw = 0.0f;
    private float pitch = 0.0f;

    // Start is called before the first frame update
    void Start()
        Cursor.lockState = CursorLockMode.Locked;

    // Update is called once per frame
    void Update()
        yaw += speedH * Input.GetAxis("Mouse X");
        yaw = Mathf.Clamp (yaw, minimumX, maximumX);
        pitch -= speedV * Input.GetAxis("Mouse Y");
        pitch = Mathf.Clamp(pitch, minimumY, maximumY);
        transform.eulerAngles = new Vector3(pitch, yaw, 0.0f);

@alperkicirli, first as a general rule, you can read from transform.eulerAngles, but do not set transform.eulerAngles because you can nosedive into a Gimbal Lock situation.

Instead use:

transform.rotation = Quaternion.eulerAngles(pitch, yaw, 0.0f);

Other than that, Debug.Log( "pitch = " + pitch ) immediately after your Clamp function call to see if the Clamp is indeed returning what you expect it to.

Another note: You may have a problem Clamping between -30 and 30, as when angles are converted -30 can become 330. But because you maintain pitch separately from the eulerAngles - you are not reading pitch from the object - I don’t think that is the problem.