It worked only after removing and then attaching the button component and image component.
Interestingly never had any issue with legacy GUI
I was having this problem. I was developing an AR shooting game. The problem was that the Event System Game Object was moved in to Target Builder UI Game Object. I placed it outside, like it was not a child of any thing. And so the buttons started to work. Don’t misplace Event System. Hope this helps.
I had a similar problem and thought I would share my solution.
I had a ‘root’ Canvas Game Object, which then had several child Canvas GameObjects.
In order for the Buttons to work, the Button’s direct parent Canvas must have Graphic Raycaster component. It’s not enough that the root Canvas has one.
Example:
Canvas1 // must have Graphic Raycaster for Button1 to work
Button1
SubCanvas1 // must have Graphic Raycaster for Button2 to work
Button2
SubCanvas2 // must have Graphic Raycaster for Button3 to work
Button3
This solved it for me. Thanks! I was losing the ability to press buttons after changing scenes. It was because the event system was being destroyed when loading a new scene. DontDestroyOnLoad() solved that easy enough.
the problem was on event system
Life saver. reading yours made me realized i needed to give the canvas a higher sort order
In my case, the problem was in the hierarchy view.
In the Canvas, I created a GameObject.
The GameObject had 2 Button objects, and 3 another objects.
The objects inside the GameObject were not in the appropriate order.
Changing the order as it is in the scene worked for me.
My hierarchy goes:
PanelMenu
ButtonMainMenu
ButtonRestart```
(I renamed the UI element to fit the project)
Under Canvas in ur button check for interactable in the components
I did exactly the same thing because I was pretty new to Unity months ago. EventSystem is very necessary to get the UI elements work correctly in Unity.
UI elements under Canvas objects are rendered according to their hierarchy. Objects at the bottom will be rendered on top. So move your button to the bottom of the Canvas hierarchy, maybe something it is blocking it. Also move the Event System to the top of the hierarchy
OMG! You saved my life! I was almost exporting the whole project to a new one because suddenly buttons and scroll rects stop working and this answer was the best! I problably deleted it in some moment and I didn’t realize it.
In my case i accidently deleted event system and then just forgot about it . After 4 hours i finally found what was cousing the error.
I fucking love you
BLESS YOU!! I have been trying to figure out why my UI didn’t work for literally the last 2 days. You are a lifesaver!!!
God swear I tried every f**king trick from the comments and nothing worked
Same maybe its a problem with a new version of Unity… Some scenes my buttons work and others they dont at all SO FRUSTRATING
For my case just now, something (nearly) transparent is blocking the button.haha
Works as charm, just added and all work
Thanks a lot @[takatok]( https://discussions.unity.com/t/637700 members/takatok.1164327/) was struggling to get UI button working - no where i could find step by step for UI button. Was struggling the whole day to get button click working, your steps mentioned here helped me. Thanks