Hello people,
I have a certain problem with these 2 controls:
https://image.ibb.co/f5hbG8/Screenshot_13.png
"Control" and "Control1" have the same script:
extends Control
func _ready():
connect("mouse_entered",self,"mouse_is_in")
func mouse_is_in():
print(name)
What I want to do is both of them printing their name. However it only prints the name of "Control2". If I put "Control" under "Control2" it only print the name of "Control".
Your image doesn't show.
Note you can upload it on Github by just pasting it in the post. You can also do that with a zip file containing your test project ;)
Thanks for the info i updated my post.
Yeah looks strange even with "mouse filter pass" it is not working (didn't test your project).
As a workaround you can maybe use this?
func _ready():
$Control.set_mouse_filter($Control.MOUSE_FILTER_PASS)
$Control2.set_mouse_filter($Control.MOUSE_FILTER_PASS)
$Control.connect("gui_input",self,"gui_input", [$Control])
$Control2.connect("gui_input",self,"gui_input", [$Control2])
func gui_input(event, control):
if control.get_global_rect().has_point(get_global_mouse_position() ):
print(control.name)
I implented your code however the problem still is the same. It only prints the name of "Control"
Maybe you have to set "mouse filter pass"? I tested this code it should work.
Edit: I added two lines so that you don't have to set it manually in the inspector.
Yep. Still the same problem. The 2 Control Nodes I have must have the exact same rect_size.
Hmm no Idea why it worked before :D maybe this will work?
func _input(event):
if $Control.get_global_rect().has_point(get_global_mouse_position() ):
print($Control.name)
if $Control2.get_global_rect().has_point(get_global_mouse_position() ):
print($Control2.name)
It finally works. I've been stuck in this problem for a while ... thank you so much!
While there is a workaround, I still think it's a bug.
It's not a bug, it's the way controls work. If you have the mouse filter set to "Stop" then only the first control will receive the input. You need to set to "Pass" so it receives the event but also let it available to other controls.
Did you try pass? It didn't work.
If it doesn't work with Pass it's a bug, but I noticed there's already an issue about it: #19785.