Button not working

I tried to use the Forums but no one was able to help me.

I have a screen with a button created as follows:

GameObject → UI → Text

I added the UI → Button component to make it a button.

I changed the Highlight and Pressed colors.

The button worked until I did two things.

  1. I added music which seemed to be OK
  2. The Title on the screen was too large for the current resolution so I increased the resolution.

Now, when I enter the level and hover over the button, instead of it turning Green (Highlight color) it does not change and when I click it to activate it, the Pressed color does not change.

I tried to add a new button but that too does not work.

Any suggestions would be greatly appreciated.

Hi,

Try making your button last sibling in your UI hierarchy, you can only interact with the top layer of the UI (first sibling is at the bottom and last sibling is atop everyone else). If you have UI stuff piled, it may cover your button (even with a transparent thing)

Do the UI check. Do you have

  • An EventSystem GameObject?
  • A Canvas with a GraphicsRayCaster?
  • Is your button enabled and set to interactable?

Try creating a new button and see if that works.

Hi KDRWaylander,

Thanks for your response.

I tried the new button first and it did not work. That is why I determined that it was a Canvas issue.

I did not realize that the physical position in the hierarchy mattered.

Anyway, I resolved the issue.

I created a new Canvas and copied the items from the original Canvas to the new one.

I only wish I could have determined what caused the issue in case it happens again.

magicscreen

I have the same problem =(( work with UI from gamePad is awful in Unity=(