AR Foundation ARRaycastmanager ray passing through UI,AR Foundation - ARRaycastmanager ray passing through UI

hi there, i m working with ARFoundation, the ray is passing through UI. ray is not blocking even after checking the eventsystem condition

int id = touch.fingerId;
if (!EventSystem.current.IsPointerOverGameObject(id)),hi there i m not able to block ray from ARRaycastmanager, i checking finger toch

int id = touch.fingerId;
if (!EventSystem.current.IsPointerOverGameObject(id))


Test your touch input first with this code. If it returns true, then your touch was not over a UI element and you can use the touched position for whatever you like.

    /// <summary>
    /// Get the on-screen position of the users touch input 
    /// but ignore touches on UI elements
    /// </summary>
    /// <param name="_touchedPos"></param>
    /// <returns>True if screen is touched</returns>
    bool GetTouchPosition(out Vector2 _touchedPos)

        if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)

            if (!EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId))
                _touchedPos = Input.GetTouch(0).position;
                return true;
        _touchedPos = default;
        return false;