0 votes

I can't seem to get multitouch working to my satisfaction.

If I use standard buttons (e.g. button/texture button) I can only press one at a time. Indeed, pressing anywhere on the screen, even on non-button elements prevents pressing on a TextureButton.

I see there is a Node called TouchScreenButton, but I assume this is experimental feature, as it's missing a number of basic button functionality, such as being able to disable them.

So my question is three-fold:

1) Is there a way to make nodes completely ignore all touch events, i.e. TextureButtons still work if you're also touching the background

2) Is there a way to disable interactivity on TouchScreenButtons so that they are actually worth using.

3) Is there a better way to handle multi-touch buttons?

Godot version 3.4.4
in Engine by (17 points)
edited by

1 Answer

0 votes

Here is a project I made that uses touchscreenbuttons extensively.

It is odd that they don't have a disabled property, but it is easy to implement yourself. Since they are not control nodes, I usually make them children of a control node, give a script to that node, and connect the touchscreenbutton pressed and released signal. In that script, you can just make an export var disabled := false and then do if !disabled: in the _on_pressed and _on_released functions.

by (608 points)

The problem with that, unless I'm misunderstanding something, is that the buttons are still clickable - sure, any code associated with the button won't run, but the textures will still change to the pressed and normal ones.

In the end I have made it a child of a Control node and then added a TextureRect with the desired "disabled" state underneath. So when I want to disable the button I swap the visibility of touchscreenbutton and texturerect to give the illusion of it being disabled. Not the nicest, but it gets the job done.

Yeah, I think that is what you'll have to do. make a function disable() that just removes the pressed texture and makes the normal texture your disabled texture (or just change the opacity of the normal texture).

You should open a feature request on GitHub. I never realized how annoying that is.

Is there another way to fix this problem? My version of Godot is not suitable for the plugin, so in addition it also turns out to be incomplete.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.