Closed
Description
Tested versions
Reproducible in 4.2.1-stable and 4.2.2-stable, not in 4.1-stable
System information
Godot v4.2.2.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2070 SUPER (NVIDIA; 31.0.15.3623) - AMD Ryzen 7 3700X 8-Core Processor (16 Threads)
Issue description
mouse_entered signal reside in a StaticBody2D under a SubViewport will not trigger anymore after GUI Disable Input
is toggled off and on.
Steps to reproduce
- Open the MRP.
- Play the scene.
- Move mouse cursor onto the Godot logo.
- Observe the
enter
text printed out in the Output panel. - Select Remote at the Scene dock.
- Click on SubViewport.
- Toggle GUI > Disable Input On and Off.
- Repeat Step 3.
- No subsequent
enter
text will be print out in the Output panel.
Activity
AThousandShips commentedon Apr 29, 2024
Sauermann commentedon Apr 29, 2024
bisected to #67791
I was unable to reproduce the bug in v4.3.dev.custom_build [6118592] (with MRP adjusted
$SubViewportContainer.mouse_filter
)Sauermann commentedon Apr 29, 2024
Very interesting MRP. The MRP works as expected, but the reason is quite complex.
So I start with how to solve your problem:
Instead of pushing the input to the
SubViewport
withinSubViewportContainer._unhandled_input
, use theSubViewportContainers
default implementation for doing this. There has been some effort to make this more effortless for Godot 4. You can achieve this by two changes:GameInstance.gd
, remove the function_unhandled_input
completelyGameInstance
, change the propertyControl > Mouse > filter
(mouse_filter) fromIgnore
toStop
orPass
.I remember seeing this kind of implementation for SubViewport-input-propagation as a workaround for bugs in previous Godot versions, that have been fixed since.
Why doesn't your MRP work the way you expect: Toggling
gui_disable_input
toon
has the effect, that the Viewport gets into a state, where it thinks, that the mouse is no longer over it. Togglinggui_disable_input
tooff
afterwards doesn't reset this state.Also sending a mouse event by
gameViewport.push_input(event, true)
is not enough to reset the state. So as a workaround you could adjust your_unhandled_input
function like this:But I don't recommend this approach, because this is just a workaround for no longer existing bugs, would need additional refinement and because the other method is the way it is supposed to be used.
Does this solve your problem?
9 remaining items