This is probably a quick and easy fix but I can't seem to get it. As the title says I've got UI buttons which appear when my character dies, they used to work just fine but now suddenly when doing a full test through they don't seem to work. I've found similar posts where the solution was to disable / enable raycasts, that didn't help. Another user was missing an input module from the event system, mine seems to be there an in check.

The only significant change that I think will have affected my UI buttons was the addition of a joystick and another UI button, i thought perhaps they are blocking the older buttons but I've disabled the joystick and new button, that didn't help, even tried changing the zaxis, that didn't help too.

I'm honestly not sure how to go about testing something like this.

enter image description here

The UI overlay is my canvas, the GameOver object is disabled on start then enabled when the player dies, showing the Gameover text, Button quit and rety, these are the buttons that no longer work.

enter image description here

My button retry's settings, mostly unchanged honestly.


  • \$\begingroup\$ Does your button's parent canvas have a GraphicRaycaster component? Is GameOverUI.OnRetryClick() non-empty? \$\endgroup\$ Commented Jan 8, 2019 at 18:36
  • \$\begingroup\$ @Draco18s The parent doesn't have a GraphicRaycaster and OnRetryClick isn't an empty method, if that's what you meant. \$\endgroup\$
    – Demonic218
    Commented Jan 8, 2019 at 18:58
  • \$\begingroup\$ @Draco18s Adding the GraphicRaycaster did the trick, will you add it as an answer so I can accept it. \$\endgroup\$
    – Demonic218
    Commented Jan 8, 2019 at 19:21

1 Answer 1


You need a graphic raycaster

The nearest direct parent Canvas of any UI element which is top receive mouse input needs to have a GraphicRaycaster component.

This is not to say that the button's patent needs this, but the first patent in the hierarchy that already had a Canvas needs to have it. In your case, likely the UIOverlay object in your scene hierarchy list, though it is possible that it is the GameOver object.

Unity automatically attaches both when you create any UI element with the GameObject menu, however if you are building UI yourself, or make use of child canvases (this can be a good thing) you need to attach a GraphicRaycaster if any element of that canvas needs mouse input.

  • 1
    \$\begingroup\$ I recommend the linked videos. Timecodes are approximate where the speaker talks about UI and canvases. \$\endgroup\$ Commented Jan 8, 2019 at 19:52
  • \$\begingroup\$ Hey I have my graphics ray caster component in my canvas but nothing is still working \$\endgroup\$
    – Jeremiah
    Commented Apr 15, 2020 at 4:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .