Unity 5 buttons not interacting within a nested canvas
I create a button within a regular canvas and it works just fine. When I put the same button in a canvas that is within another canvas, the button still appears but is no longer interactable when I play the scene. What could be the problem?
My parent canvas has the following components: Canvas (screen space - overlay), Canvas Scaler, 2 scripts The child canvas has these components: Canvas, Graphic Raycaster, Canvas Scaler, 1 script
Answer by Matthew_Armocida · Nov 14, 2015 at 03:12 AM
Hey there. I was having the same problem today. I know it's been a while since you posted the question but I figured out a easy fix and figured I'd throw it up here so anyone googling the issue could find it a bit easier.
As it turns out this is a matter of raycasting. Simply put you can fix it by giving the nested canvas objects a Graphic Raycaster component. Ignore Reversed Gravity, Blocking Objects, and Blocking Mask fields are not important for the fix so you can set those to whatever you need or leave them as default. The important thing is of course that it has the component.
That alone will should fix the problem you're experiencing. Hope it helps.
To clarify, the objects which have the canvas get the component. You don't need to do it for any of the child objects unless the child objects have canvas' themselves.
Your answer
Follow this Question
Related Questions
Display rigidbody speed to a world space canvas text 2 Answers
How to make Canvas appear after GUI texture? Unity 4.7 1 Answer
UI Element not turning on with SetActive(true) 1 Answer
RTS Click Drag Selection box not working with GUI canvas 1 Answer
Problems with UI buttons and Cursor position (or) UI buttons and instantiated canvas. 1 Answer