0
votes

I have made the program so that, once the level is done, a panel will pop up and this button is attached. However this button is not working.

I have - Checked my eventsystem, Checked Raycast Settings, Set the onclick event, Also brought the button out on the z axis so that it would have no interference from the panel.

My Hierarchy

enter image description here

Button's Inspector

enter image description here

Canvas' Inspector

enter image description here

3
On Canvas the order in which the elements appear MATTER. Make sure there are no panels or full-screen size images below (in the hierarchy) of the button, in practice, everything that is static should be on top while everything that is interactable should be on the bottom. - Vitor Figueredo

3 Answers

4
votes

It's because you original color of the Image is completely black. The Button component just tries to tint the original color, but because it's black, you see no effect.

Oh, and... As @Glurth said, you have enabled Block Raycast on the CanvasGroup, so basiclly the Button doesn't even receive pointer events.

0
votes

I see you have "Blocks Raycasts" configured for the Canvas group, which you have added to the canvas itself.

I don't think this component is supposed to go on the canvas itself anyway; it's intended to allow one to disable or hide groups of objects on your canvas. The "blocks raycasts" is intended to prevent clicking on controls that are behind this group, and collect clicks for the group itself. If you put everything on your canavas in this group, it will collect all the clicks for everything.

0
votes

I found my problem, i had 'ignore parent groups' unchecked which did not allow the mouse pointer to recognise the button as it was a 'child' of canvas

Thankyou all for your help!

My Canvas Inspector component, Canvas Group