Canvas button not registering clicks
I have been trying for several hours to fix a button for a group project with no luck. I have the basics such as the object being a child of the canvas, graphics raycaster, button script, event system, etc.
There is no code going into this at the moment. Everything is done strictly with Unity's canvas and buttons. Upon clicking, the image should disappear, but it doesn't. The event handler does not register anything when the mouse hovers over the image.
I have looked through several posts on the Unity forum/answers to try and find an answer that would work and none have helped.
https://i.stack.imgur.com/znSlf.png
https://i.stack.imgur.com/CmXO4.jpg
Answer by prstorero · Dec 03, 2017 at 09:07 PM
I figured out the problem. I needed to attach a camera that would be looking at the canvas to the "event camera" of the canvas component.
Answer by Ozgi · Dec 03, 2017 at 09:21 PM
Hi, you can try to add a "Canvas Group" game object to the Canvas and check "Interactable" and "Blocks Raycasts".
If that doesn't work then you can just add a default button and change its sprite rather than adding a Button script to the image.