Unity 4.6 Buttons not responding in second canvas?

I created a second canvas that contains a button, but this button doesn’t respond to touch. It just behaves like a static image. How can I work around that or is this by design? The Event System is there. The two canvas’s are on the same level aka siblings.

I fixed that issue adding a ‘Graphic Raycaster’ component to every GameObject with a ‘Canvas’.
I recommend to manage enabling and disabling event in different Canvases with a CanvasGroup component.

I’ve run into similar problems. Check that the button has an image attached, also check that you’re not raycasting against the back of the button (see the GraphicsRaycaster on the canvas GameObject)

I had the same problem when I first started using the new UI.

A panel or any element really can be completely invisible but still block raycasts.

If both Canvases can be shown together make sure the Canvas you don’t want to use is disabled, or at least put a Canvas Group on is and un-tick interactable and blocksRaycast.

On the canvase with the button look for any transform that could block the button. Due to rescaling this may not be obvious so just disable every other element on that canvas until you find the one that’s blocking.

Check the draw order of canvases. May be that’s what’s preventing input events. From this post, it says

The draw order is determine by the z position for Screen Space - Overlay canvas’s.

Also, try to play with the Sort Order field of Canvas component of both. I think it behaves the same way as Sprite sorting does.

I was running into a case of 2 canvas’s elements interacting strangely. Sometimes the “rear” canvas would interfere/block raycast detection on the “front” canvas, and sometimes not.

In the end I finally noticed and used the PRIORITY property in the Graphic Raycaster script to resolve the issue. Priority works such that lower numbers get priority over higher numbers. A priority 1 graphic raycaster will register, for example, a MouseEnter event over a priority 2 graphic raycaster. Incidentally this seems to be the most direct way to control ray caster interactions.

I tried all the other methods in this thread to try to decide which order recasts would be detected and this directly affected the results regardless of the sorting layers etc.

I tried to essentially push the rear canvas back so that my game would register raycasting to the front canvas whenever it overlapped the rear canvas. As per the ideas in this thread I tried varying the Canvas Sorting Layer and Order in Layer on the Canvas component in the inspector as altering Blocking Mask and Blocking Objects values in the Graphics Raycaster component. Neither of these seemed to affect the behavior. I tried adding the Canvas Group component and playing with the Interactable and Blocks Raycasts toggles, but they both resulted in the loss of raycast detection entirely on the rear canvas I was altering. None of these things worked, but setting priorities did.

Hope this helps someone else in my situation.

I had this problem too. I had two canvases and multiple cameras. Make sure all camera that you want to receive UI click events, set tag to “Main Camera”

I solved it just duplicating the image game object inside the second canvas and deleting the origin image. I have no idea why it worked :slight_smile: