Search Unity

  1. Unity 2019.1 beta is now available.
    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. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    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:
    32
    have same problem on 2018.2.6f1.
     
  3. Romaleks360

    Romaleks360

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