Search Unity

Bug OnMouseDown is triggered even when the UI interface is on top

Discussion in 'Scripting' started by ProGameDevUser, Mar 26, 2023.

  1. ProGameDevUser

    ProGameDevUser

    Joined:
    Mar 17, 2018
    Posts:
    115
    Hi! Faced with such a problem, on phones, when you click on the Sprite icons with the OnMouseDown method, it triggers even if there is a UI element on top, I tried different methods that I found on the Internet and nothing helps, including using the condition before calling if (EventSystem.current.IsPointerOverGameObject()) return; and it also does not works, please help, editor version 2021.3.9.f1