Blocking pass-through input

Godot Version



I have a TouchScreenButton that is on top of another TouchScreenButton. When you click on the top one, clicking on the one below it also works. How to avoid this? Processing of clicks occurs through the binding of TSB signals to functions in the script.

This happens when you click Use once. A Menu also opens on the adjacent cell, since the click is processed by it too.


Just a simple idea might work. You can create a variable you control to call functions such as $ and $TouchScreenButton.hide()

1 Like

If you mean hiding the TSB that is located below the button, then yes, it will work. But it seems to me that this is not the optimal option, since this happens in the inventory. I’ll have to hide the TSB at each iteration of the Inventory Slot to avoid double tapping. But, if I can’t figure out how to achieve this in another way, then I’ll use the one you suggested x)

You can also modify the TouchScreenButton to manage 2 things with a variable. With the same visible modifier.
Like, if menu.visible = true: close_menu()
if menu.visible = false: open_menu()

You’re just not a very data driven person. Because it’s just one button. You have to instruct interactions with better functions. Have a button do multiple things and how it determines the input. Instead of creating too many options for every object. This would be the only time I would suggest the group commands. Although still incorrect to use. Because you’re bound to find your limitations in groups as well. For example; tracking, sorting and stacking groups at the same time on the code level.

If this is part of a Inventory it is best to use Control type Buttons. TSB should only be used for actions, especially held actions like walking or jumping

1 Like

One solution is to use Control Buttons instead of TSB. But you also need to take into account the position of the button in the node hierarchy; the top button should be located lower in the node hierarchy than the button below it.

1 Like

Why not keep things simple. Why do presses overlap to begin with?

Can you enable or disable one function while the other is active?

And maybe clicking away disables the “use” dropdown?