Pause menu works with keyboard but doesn't work with touch screen



image
Hello guys, The problem is when I use a touch screen device and press the menu button, it sometimes works and sometimes it just reloads the scene. As you can see, the screenshots are the only place that are related to the buttons showed. Idk how it is like that because it works fine with pc (keyboard).
Thank you very much!

When you add the pause menu, do any of the buttons overlap with the reset button? It could be possible that both buttons are being triggered.

On touch devices, the cursor remains at the last location. So, when you click a button on the pause menu, it moves the cursor. If the button closes the pause menu and changes the pause variable and the cursor is in the same position as the reset sprite then it could trigger it.

I have checked and no button was overlapped. here is the link to the game, can u help me please?, thank you very much :frowning:

I tried it. I didn’t understand the rules right away and I couldn’t play with the menus for long without dying. I still think it might be the touch/ cursor issue. It might be in the opposite order of events. The cursor might be where the button is before the menu is opened. Maybe from touching the screen during gameplay or after touching a level button that’s in the same position. IDK. That’s my only guess. I know you can disable the cursor from moving with touch but then that changes the needed conditions. Neither is my expertise. But maybe this will point you in the right direction or someone else can help.

yep, thank you for your efforts, I will try to look into it more, disable this and that :v

1 Like

I found out something. The button only works well when the player is not moving. However, my game is a constant moving game and you can’t just stop. I tried several ways, but nothing worked. Does this give you any hint? :frowning: please help me.

Sorry. I have no idea either.

There is extension


Which gives you condition to check if button is pressed or released after you add that behavior to your button object

And so your buttons work for touch and none touch devices
And it is easier to test on both

Maybe that will change something for you

thank you very much, I will test it