SubViewportContainer blocking mouse events of its siblings

Godot Version

4.3

Question

My current hierarchy:

  • SubViewportContainer (mouse filter: pass)
    • SubViewport (Object picking: true)
      • Node2D
        • Child Area2D (mouse_enter and mouse_exit handlers)
  • Sibling Nodes
    • Sibling Aread2D (above subview container blocks mouse events)

With this setup it allows the mouse event handlers in the Child Area2D’s script to function correctly. However, this has a side-effect of blocking events from working in the container’s siblings.

If I change the mouse filter to ignore or stop, the siblings work fine, but the children are now blocked.

How can I set it up so the container’s siblings and children work in harmony?

This is currently not possible in the engine.

Short version: Mixing Control nodes (SubViewportContainer) and Node2d nodes (Area2D) in a Viewport is in most cases never a good idea.

Long version:
Input events are first handled by Control nodes (SubViewportContainer) and since that event is used for physics picking in the SubVieport, it is set to handled. So that Input Event is not used for physics picking in the main Viewport (where the Area2D is).

One way to work around this is to put the sibling nodes in a sepate SubViewport child of the SubViewportContainer (set handle_input_locally to true):

  • SubVIewportContainer (mouse filter: pass)
    • SubViewport (Object picking: true)
      • Node2D
        • Child Area2D (mouse_enter and mouse_exit handlers)
    • SubViewport (Object picking: true)
      • Sibling Area2D

That way the Input Event is forwarded to both SubViewports and physics picking happens in both SubViewports.

Thank you. The work around looks like a good solution. Worth a try!