Can touch input trigger the pressed() signal of a regular button?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By derekjwhitten

I have a lot of regular buttons in my game, and had “emulate mouse from touch” enabled in project settings.

Now, however, I need to use the touch event for pinch zooming on Android, but to do this I need to disabled this project setting. Doing this causes all the regular buttons to stop responding to touch inputs.

Is there a way to trigger regular buttons with touch input? Or do I need to replace them all with touch buttons?

:bust_in_silhouette: Reply From: Raheel

Adding the results of my investigation here in case someone else stumbles upon this question.

No, UI button cannot be pressed by Touch Input Events. The TouchScreenButton doc says the following

If you want to create menus or user interfaces, you may want to use Button nodes instead. To make button nodes react to touch events, you can enable the Emulate Mouse option in the Project Settings.

If you’re making a game that runs on both mouse input and touchscreen input, you will run into a problem when you turn on the emulation. Both Mouse and Touch Input Events will be fired when you’re on a touch screen device. In my case, I manually suppressed mouse input on touchscreen devices. I did that by checking in the _Input function if any touch input was detected and if it is I set a flag to disable mouse inputs.