After upgrade to 4.6.1f1, I can’t set canvas (GraphicsRaycast) priority to control one canvas block other canvas behind of it when user does any interaction.
Originally I have one canvas with a dialog UI and I put a transparent image behind of it and attach “Click” event trigger to catch touch event. Then all other canvas behind of it will not receive the event. But now it can’t work because the front canvas can’t stop the event and all canvas will receive the event.
What I could figure out is I have to add code to disable all other canvas GraphicsRaycast component or set CanvasGroup component blockRaycast to false. But the solution needs me add code and can’t pre-define the logic when I edit a UI prefab.
Did I miss some new component which can do this thing? Any thoughts? Thanks!
Hi,
This is a really old thread but i am still having this issue in 2019.1.13f1.
I have multiple WorldSpace canvas, all of them with a background, texts and buttons. When i have 2 canvas one on top of the other, the canvas at the back keeps ‘capturing’ the events even if the canvas in front is hiding it (note: the background of the canvas in front doesn’t have any GraphicRaycaster).
I tried the WorldRaycaster solution proposed in the thread @phil-Unity posted, but i don’t know which canvas will be in front of which, so it can be difficult to assign Sort orders during runtime… Isn’t there any component that just blocks the GrpahicRaycasts? I tried adding EventTriggers, GraphicRaycasters or Button components but none of the worked…
Just had this issue and from reading the above linked forum post I found that you can set this in the Canvas component. Under Render Mode - Order in Layer, just set a higher number in the canvas you want to receive the clicks.
I have two canvases. One is my ‘main’ canvas, set at the highest level in my hierarchy (same level as gameobjects). I have a 3D gameobject with a ‘Q&A’ canvas child on it. When I click my gameobject, the Q&A canvas opens. I want my Q&A canvas to block mouse clicks on my main canvas. My main canvas has components- Canvas and Graphics Raycaster(GR). Canvas sort order is set to 0. GR is set Blocking Objects = All, Blocking Mask = Everything.
My Q&A canvas has components- Canvas, GR, and Canvas Group. Canvas sort order is set to 1 (and does draw on top). GR is set Blocking Objects = None, Blocking Mask = Everything. Canvas Group Interactable and Block Raycasts are set on (true). I’m using version 2019.2.0f1. My parent gameobject is on the Default layer, main canvas on the UI layer, Q&A canvas on the UI layer. Both canvases are set to screen space overlay. My main canvas has a script on it to control cursor changes. Q&A has no (personal) scripts. My gameobject has script that controls question and answer display, toggles, etc.
My Q&A canvas does not block mouse clicks of buttons on my Main canvas. I would like it to. What do I need to do differently? Thanks.