-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gui_input not being called if the touch starts on another control #83465
Comments
Using TouchScreenButton instead of Button is recommended for proper touch button handling until godotengine/godot-proposals#3976 is implemented. |
This applies to all Control nodes, not only buttons. |
This is fixed for the Which Please upload a minimal reproduction project1 to make this easier to troubleshoot. Footnotes
|
Added a video explaining it, and a MRP. It's on the .NET version since I had some trouble trying to translate the lambda to GDScript.
My bad, the signal was "gui_input" on the Control node |
Hitting this issue too on PC. Basically, I'm tring to see which PanelContainer the mouse click is released at. I have two PanelContainers next to each other. If I click on one and move the mouse to another one, the gui_input event is not triggered in the second PanelContainer, only the first one, despite Maybe this is the expected behavior and I missed it. If so, I don't see any way of having this behavior currently. |
Also having this issue on PC: func _ready() -> void:
for i : int in pow(%GridContainer.columns, 2):
var tile : Control = Control.new()
tile.name = str(Vector2i(i / %GridContainer.columns, i % %GridContainer.columns))
tile.custom_minimum_size = Vector2(16, 16)
%GridContainer.add_child(tile)
tile.gui_input.connect(_detect.bind(tile))
func _detect(event : InputEvent, tile : Control) -> void:
if event is InputEventMouseMotion:
print(tile.name) If the mouse is not held, the name of the tile currently under the mouse is printed. If you hold the mouse down then it will always print the name of the tile that was clicked on, regardless of where the mouse currently is. |
|
Godot version
v4.2.dev4.mono.official [549fcce]
System information
Windows 10
Issue description
Let's assume this setup.
You have two control nodes, with the same script. This script listens to the gui_input event signal.
Holding the touch/click. If you start your touch/click on an empty space, it will call the method when hovering over the control node, but, if that touch/click starts on top of one of the control nodes, it will not get called.
I have checked the other workarounds like checking if the point is inside the control area's and checking mouse enter exit. But at least in my case that wont work because:
-Two control areas can be overlapping, so the one at the top should win
-On mobile on_mouse_enter does not trigger
Is this by design? Or is it an error? If it's by design, what is the expected solution?
Steps to reproduce
2023-10-17.08-52-18.mp4
Minimal reproduction project
MRP.zip
The text was updated successfully, but these errors were encountered: