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 :slight_smile:

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.

Very Simple.
Create a Canvas and eventsystem again.