I used method below to check if button(object) is clicked. The problem is that I have a Confiner which is streched over the entire level and as a result method determine this Confiner but not the object that I need. So the question is can I somehow ignore confiner and only check if I clicked an object?
void OnMouseDown()
{
....
}
Implement IPointerClickHandler interface (from UnityEngine.EventSystems). This also works for 3d objects if your camera has PhysicsRaycaster component