Andy Webb
Andy Webb

Reputation: 23

Unity Button not working/highlighting/interacting

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

Upvotes: 2

Views: 9509

Answers (3)

Andy Webb
Andy Webb

Reputation: 23

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

Upvotes: 0

tsvedas
tsvedas

Reputation: 1069

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.

Upvotes: 6

Glurth
Glurth

Reputation: 300

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.

Upvotes: 0

Related Questions