Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

[5.2.1p4] Image not blocking click?

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

  1. Matheuz

    Matheuz

    Joined:
    Aug 27, 2014
    Posts:
    6
    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):http://www48.zippyshare.com/v/noIQmtnX/file.html 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?

    http://answers.unity3d.com/questions/816861/46-ui-image-is-capturing-clicks-how-to-prevent.html

    http://answers.unity3d.com/questions/830371/ui-46-image-blocks-mouse-click.html

    http://answers.unity3d.com/questions/827821/unity-46-ui-ignore-raycast.html

    Thread on Unity Answers, where I was discussing it before it started deleting my comments automatically and moved to the Forum: http://answers.unity3d.com/questions/1085178/ui-image-not-blocking-raycast.html#comment-1085771
     
    Last edited: Oct 21, 2015
    undefined666 and electric_jesus like this.
  2. undefined666

    undefined666

    Joined:
    Apr 3, 2018
    Posts:
    28
    have same problem on 2018.2.6f1.