Blocking objects confusion

Home Forums Books Unity 3D UI Essentials Blocking objects confusion

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • #6640
    Paul Hogan

    This is one topic that is stumping me at present with regard to what you need to do to achieve this goal.

    I have tried using just the Canvas Graphic Raycaster with Blocking Objects set to 2D then 3D then everything, but the tap which the button receives still gets passed to the 3D objects in my scene.

    I have tried using a Physics Raycaster attached to the camera and used a separate script attached to my game object implementing the IPointerClickHandler but still the taps pass through.



    Right first, the answer to your query is a CanvasGroup.  it is the only component that will actively block raycasts from passing through it.

    You simply add it to the UI control (or grouping GO the UI is attached to) to stop raycasts (all raycasts) passing through the Rect Transform of the GO by selecting the “Block Raycasts” parameter.

    The Blocking option only affects other elements within the view of the camera the UI is attached to, similar to Camera layers and depth flags.


    Hope this helps.

    Simon (Darkside) Jackson

    Paul Hogan

    Hi, thanks, I tried that, still the taps go through?

    Stumped as not sure what the canvas graphic raycaster blocking objects is actually for if you then have to add a control group with a setting to block raycasting too?

    Also could it be that it is the way I am intercepting taps in my other script that users the old touch count, creates a raycast and tests for object name to decide a hit?

    Should I be removing this and moving to the IPointerClickHandler approach in conjunction with control group?



    I do find a lot of cases that I’m responding to require setting up a new script.

    The interfaces are really easy to implement (and extend).

    They only provided a basic set of “out of the box” controls, for everything else you have to build your own.


    Looking at the source (, the Blocking options only affect the UI canvas raycasting. Does not affect the rest of your 3D scene.

    The CanvasGroup is supposed to block raycasts, so it is odd that it isn’t.  Will investigate further.

    Note the UI Extensions post on the forum, I’m managing a bitbucket repository with a host of community built controls to fill in gaps.

    Simon (Darkside) Jackson

    Paul Hogan

    Ah, that is annoying!

    I’ve tried the advanced choice on this and still the taps go through?

    Will have to scour the Internet to see if I can find an answer…


    That is certainly one path I had never considered.  Attaching UI scripts/events to NON-UI elements.

    As you have read, the book is all about using the UI.


    All of the guys suggestions seem to be about altering the behaviour of your 3D/2D game and not about managing the UI. (#Shudder EventTrigger)

    I agree, certainly worth more investigation.

    Simon (Darkside) Jackson

    Paul Hogan

    Back here again and find it funny (in a way) that I am revisiting the exact same problem on a new app, I never did get it resolved back in Feb.   I found this thread by Googling and found it was me that started it lol.

    Do you know of any update that addresses this problem, still get taps passing through my buttons to the 3D gameobjects below 🙁


    Sorry I missed this. Are you still experiencing issues?

    I’ve done testing in this area (especially through the UI Extensions) and not experienced any issues.

    Did you solve your problem and what was the fix (if any?)

    Simon (Darkside) Jackson

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘Unity 3D UI Essentials’ is closed to new topics and replies.