Search code examples
androidunity-game-enginecanvasgame-engine

Why does my UI Button works in editor but not in android after being built?


I have an annoying problem with my project on Unity2D. I have created a shop GUI, with buttons to purchase hats. However, 4 out of the 6 hats buttons are working for some reason in the android build. Whereas for some reason all of them work in editor mode... They all are in the same Canvas.

For some reason, I moved the button a little bit up, next to the seagull and they seem to be working when I do that. But I want them to work on my shop GUI like the other buttons :X I don't have anything transparent blocking the buttons by the way (And if I did, it would not work in editor mode as well, right?)

I already tried to - Move from OnClick() to Event Trigger Pointer Down (no success) - Change Drag Thresold in the event manager. - Check Force Active in event manager. - Redoing the buttons that are not working from scratch...

I'm really clueless, and I need your help!

Some screenshots :

The Canvas containing my buttons The Canvas containing my buttons

Green are working buttons, red are not working, and orange is selected (work in editor) see bottom right corner [Green are working buttons, red are not working, and orange is selected (work in editor) see bottom right corner2

The poop button which is not working


Solution

  • for some reasons try placing your button as the lowest index siblings in the hierarchy so that no other UI element overlaps them. Secondly try using reference resolution as 1080 X 1920 with match factor as 0.5