currentSelectedGameObject only works when navigation is enabled.
However, I need to have navigation off.
Are there any other ways to achieve the same effect?
I would rather have a central script managing all of this instead of code snippets scattered everywhere checking whether that GameObject is being selected or not (i.e. not the interfaces in EventSystems).
Using GraphicRaycaster.Raycast worked.
PointerEventData pointer = new PointerEventData(EventSystem.current);
pointer.position = Input.mousePosition;
List<RaycastResult> raycastResults = new List<RaycastResult>();
if(raycastResults.Count == 0) return false;
GameObject selectedUIElement = raycastResults.gameObject;