-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Mouse input events not being detected from Area2D inside a SubViewport unless a key is pressed #84258
Comments
To confirm, this behaviour is not present in 4.1.2? |
It is not. It works fine for both the MRP and my full project. I can say it was also not working in "4.2-beta 2" but I couldn't investigate further at the time so I don't know if the missbehavior is exactly the same as I'm reporting now. |
I was going to test the build for #83276 but it's expired :( |
I have bisected this bug and it got introduced in #48800. |
Is my understanding correct, that this issue is the reason, I'm unable to get MouseEntered and MouseExited Signals (on Area2D) to work inside a SubviewPort? ObjectPicking is on and the Container has Mouse-Filter set to "Pass". This works fine on 4.1.2. I just stumbled on this after my first try to upgrade to 4.2-rc1 (from 4.1.2), but this makes 4.2 completely unusable for me. |
@KeTr Your assessment is correct. Fortunately the reason for this problem is well known: currently there are two different methods implemented in different places of the source code for determining, if an |
@Sauermann Thanks for the confirmation. I had a cursory look over the commit, that introduces this issue as well as both proposed fixes, but to be honest I'm still a Godot beginner and didn't entirely understand what's going on. So I'm gonna ask here: Is there any workaround (aside from polling the GlobalMousePosition every frame.... instead of using the broken signals) for this, or does this mean, I just have to skip 4.2 entirely if I depend on this? |
As a very crude workaround (which introduces other issues for example when setting the event to handled within the SubViewport) you could do the following:
func _input(_event):
$SubViewport.handle_input_locally = true Here is the original MRP with this change: subviewport_mrp_workaround.zip |
Hello, I had to step back for a couple of weeks but it looks like #85665 fixes this issue? Is there a build already I can test? I noticed it was merged into 4.2 branch but I actually got confused if it made it to the latest 4.2 release or not. Thank you! |
I was finally able to check this up within my project and confirmed it's working for v4.2.1 now :) Thank you for all the work. By the way, since v4.3.dev2.official [3524346] is out there I gave it a try and the problem is present, but I'm assuming some fixes weren't merged yet, but wanted to give the heads up. Thank you again. |
Godot version
v4.2.beta4.official [93cdacb]
System information
Godot v4.2.beta4 - Windows 10.0.23570 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 3060 (NVIDIA; 31.0.15.5009) - AMD Ryzen 5 5500 (12 Threads)
Issue description
Testing my 4.1.2 project with 4.2-beta 4 I noticed this behavior that might be related with the changes within subviewports and event handling. I'm not sure if any of the issues mentioned by #83276 is really similar to this so decided to open a new issue.
It seems that mouse events are not being sent to an Area2D that's a child from a sub view port, unless some other event is fired up into the main viewport before.
In the screen recording bellow, 'D' is a direct child from my root scene node while 'S' is inside a Subviewport
subviewport_mrp.DEBUG.2023-10-31.13-31-46.mp4
This is the setup:
The mouse_entered and mouse_exited events are captured properly by the direct child scene "D" while the events only has effects in "S" if other event is fired before. Per exemple, start a click in "D" and drag until "S" or hold any keyboard key pressed and hover over "S", then the mouse_entered and mouse_exited work.
Steps to reproduce
Using the given MRP:
4.1) Hold any keyboard key and hover the tile "S", it becomes green.
Minimal reproduction project
subviewport_mrp.zip
The text was updated successfully, but these errors were encountered: