Can anything block touchscreen buttons in Godot?

  • Thread starter Darkmisc
  • Start date
  • Tags
    godot
  • #1
Darkmisc
206
28
TL;DR Summary
I have a button that overlaps with a touchscreen button. When I press the button, it also presses the touchscreen button underneath. Can I stop this from happening?
Hi everyone

I have a button that overlaps with a touchscreen button. I want to be able to press the button without also pressing the touchscreen button. I can't use the .hide() function on the touchscreen button because I don't want to disable the whole touchscreen button.

Is there something I can use to block half of the touchscreen button (in the same way that you can block a button)?

If all else fails, I'm just going to make the button smaller or convert the touchscreen button to a regular button, but I'd rather not for aesthetic reasons. Thanks

1702447937868.png
 
Technology news on Phys.org
  • #2
I'm not familiar with Godot, but that seemed to be a z-index problem to me. But looking at Godot's documentation:
https://docs.godotengine.org/en/stable/classes/class_canvasitem.html#class-canvasitem-property-z-index said:
Note: Changing the Z index of a Control only affects the drawing order, not the order in which input events are handled. This can be useful to implement certain UI animations, e.g. a menu where hovered items are scaled and should overlap others.
This seems to indicate that it is the order in which you implement the input events that determines which button event is on top. Again, not an expert with Godot, but it seems to have something to do with InputMap.
 
  • Like
Likes Darkmisc

Similar threads

  • Programming and Computer Science
Replies
1
Views
841
  • Programming and Computer Science
Replies
1
Views
600
  • Programming and Computer Science
Replies
14
Views
3K
  • Programming and Computer Science
Replies
4
Views
439
  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
0
Views
564
  • Programming and Computer Science
Replies
9
Views
3K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
4
Views
407
Back
Top