UI button not working (2D) [Solved]
I feel like this is a simple fix but I've tried everything and can't solve it.
I have a button in my scene that is a child of a parent gameobject but for some reason the click is not registering at all. I've read other answers and made sure of all these things:
interactable = true
is a child of a canvas
scene contains an eventSystem (force module active)
no other ui elements are blocking the button from being pressed and more
One thing I noticed was that the EventSystem doesn't even register the button when I hover my mouse over it, as if it doesn't exist in the scene. Instead, it registers the parent gameobject. All the other buttons in my game work fine but this button just wants be a little b**ch. I've even tried deleting the button and starting over but no luck. I believe the issue lies in the parent gameobject but the parent is no different from the other parent gameobjects with buttons.
If you want me to clarify just let me know. Otherwise, any help would be appreciated :)
Answer by wgrene80 · Jul 31, 2017 at 06:09 PM
Ok I solved the issue and it lies in the buttons rect transform. I found that the button's 'Z' scale in the rect transform was set to 0 when other ui elements were set to 1. So I changed it from 0 to 1 and it works fine. I guess I accidentally set Z to 0 causing other elements to overlay it.
Answer by nasrullah378 · Nov 08, 2018 at 12:32 PM
Very Simple. Create a Canvas and eventsystem again.
Your answer
Follow this Question
Related Questions
Display loading indicator during onClick event? 0 Answers
unity 2018.3.12f1 Button OnClick call function on another instance? of script 0 Answers
UI Buttons without blocking raycast 0 Answers
Button not interactable but still responding to events. How do you fix this? 1 Answer
How do I make a UI Buttion play an Animation when pressed? 0 Answers