- Home /
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.
I added music which seemed to be OK
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.
Answer by KdRWaylander · Jun 11, 2015 at 07:33 AM
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)
Answer by Kiwasi · Jun 11, 2015 at 08:05 AM
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.
Answer by magicscreen · Jun 11, 2015 at 12:05 PM
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
Thanks Bored$$anonymous$$ormon,
Thanks for your response.
I did have a Canvas with a GraphicsRayCaster. I have no idea what that is. I tried to change it to something else but it did not fix the issue.
However, 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 deter$$anonymous$$ed what caused the issue in case it happens again.
magicscreen
I know its nearly 3 years later but I think I noticed what caused this. I did the same and created a new canvas and it fixed it, and I noticed that there was an EventSystem present that I must've deleted on the other one. Anyway, a simple fix really however still annoying to spend 4 hours on it.
Answer by mimiCryMuffin · Oct 22, 2018 at 06:25 AM
I have the same problem =(( work with UI from gamePad is awful in Unity=(
Your answer
Follow this Question
Related Questions
Highlight an area of my 3D model 1 Answer
What is happening to these normals? 0 Answers
Highlighted a game object in the hierarchy without click in the inspector ? 2 Answers
Highlight gameobject 1 Answer