Search Unity

[5.2.1p4] Image not blocking click?

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by Matheuz, Oct 21, 2015.

  1. Matheuz


    Aug 27, 2014
    I just upgraded to Unity 5.2.1p4 and I am having some issues with the UI.

    My parent object has an image, a button and its child object has an image. When I click on the child object, it doesn't block the Raycast and the parent button (behind it) gets the click. I thought Images are supposed to block Raycasts. I even tried using a Canvas Group and setting its "Block Raycasts" to true, with no success.

    The only way I found to prevent the raycast propagation was adding an empty, non-interactable button to the child object, which I think is too much.

    Things I tried:
    • Adding a Canvas Group and setting "Block Raycasts" to false. Didn't help.
    • Setting "Raycast target" to false on both objects. Didn't help.

    Am I missing something or did something change on the last updates? Is that a bug?

    There is an example project (about 30Kb): Clicking on the black square triggers the white button.

    The only thing that helps is adding either an empty Button or a Selectable component to the child object. But shouldn't images block clicks by default, even if they are empty? Isn't it what of all these links is about?

    Thread on Unity Answers, where I was discussing it before it started deleting my comments automatically and moved to the Forum:
    Last edited: Oct 21, 2015
    undefined666 and electric_jesus like this.
  2. undefined666


    Apr 3, 2018
    have same problem on 2018.2.6f1.
  3. Romaleks360


    Sep 9, 2017
    Still happens in 2018.3.2f1
    Never encountered this problem before updating from 2018.1
    Maybe some default behavior has changed?