Only UI buttons that are active in the scene when I begin play are clickable

I’m having a Unity UI problem where some of my buttons don’t react to mouse input

I have a GUI with four screens: Main Menu, Controls, Credits, and Quick Confirmation. Whichever screen is active in the scene when I begin play in editor will respond to mouse input, the others will not. The buttons that are active when the game starts will change color as I hover over them, and I can click on them to do things. The buttons that don’t respond to mouse input don’t respond at all - They don’t change color as I hover over them, and clicking has no effect

I’m using the new Input System with Unity 2019.3b

I’ve tried organizing my screens a few different ways:

  • First I had one Canvas, and all the screens were children of that. I used SetActive to enable the active UI screen and disable the inactive ones, but any screen other than the initial one didn’t respond to mouse input
  • Then I split each screen so they had their own Canvases, and I on screen transitions I Instantiated the new screen before Destroying the old one. Same problem: screens other than the initial one didn’t respond to mouse input
  • Finally, I put all the screens in my scene and once again used SetActive to enable the active one - but this time each screen had its own Canvas, rather than all the screens being children of the same Canvas. This also didn’t work

That brings us to the question: what am I doing wrong? Why are my buttons so reluctant to work?

Two main possibilities:

  • You aren’t correctly enabling the buttons that don’t start out enabled
  • Something is in front of the buttons and “blocking” the clicks

You can probably figure out which is the case by looking around in play mode while the buttons are not working.

If you select the Event System object in your hierarchy, it will display some debug information that includes things like what the mouse is pointing at and whether it is eligible to be clicked.

Also look at the button objects and make sure that the checkbox for the Button component is checked, and the checkbox for “interactable” is checked.

If there are any CanvasGroup objects anywhere above the objects in the hierarchy, make sure they have “interactable” and “blocks raycasts” boxes checked.