Button becomes unclickable if it is in the panel
In unity, I created a Canvas at the top of the hierarchy, then right clicked the canvas and created a panel, the right clicked the panel and created a button. So the canvas/panel/button hierarchy looks like:
>Canvas
>panel
>button
>text
>other stuff (no other UI elements around)
I then set the color tint stuff for the button so that it when highlighting/clicking the button it should provide visual feedback. All other settings are kept as their default with me making no changes. However, when I “play” the game, the button is not clickable at all, it has no visual feedback. The only way to get the button to work is to move it out of the panel, so that the hierarchy looks like this:
>Canvas
>Panel
>button
>text
>other stuff
The button can be placed anywhere in the canvas, as long as it is not in the panel, it is clickable. Does anyone know why this is the case? The canvas, panel and the button were all created in the hierarchy via right click, UI, and selecting the items from the list; all have their default settings, other than colour options for the button; EventSystem is also in the hierarchy, and the Canvas also has the Graphic Raycaster component.
Any help would be appreciated!
Your answer
Follow this Question
Related Questions
Button in one panel affects another? 1 Answer
UI Button not working? 0 Answers
AddListener fuction throwing a NullReferenceException error 1 Answer