Topic was automatically imported from the old Question2Answer platform.
Asked By
HarryMD
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:
Is there a way to make nodes completely ignore all touch events, i.e. TextureButtons still work if you’re also touching the background
Is there a way to disable interactivity on TouchScreenButtons so that they are actually worth using.
Is there a better way to handle multi-touch buttons?
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.
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.
HarryMD | 2022-07-28 20:41
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.
scrubswithnosleeves | 2022-07-28 21:03
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.