Search Unity

IsPointerOverGameObject Returns True When There's Nothing There

Discussion in 'Scripting' started by John-B, Apr 25, 2019.

  1. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    Is there a way to get the UI object that's causing IsPointerOverGameObject to return true? It returns true for touches within a certain area of the screen (iOS) even though there is no UI element there. I'm using IsPointerOverGameObject to check a camera-pan gesture, so the gesture is ignored if the touch is on a button. It works correctly except for an area in the center of the screen. UI objects in that area are not active at the time and are not raycast targets. It even returns true for touches in that area if there is no active canvas and no UI objects on screen. I'd like to know what it thinks these touches are hitting. Raycasts don't hit anything, so aren't very informative.