Why can't my Camera2D script get any _unhandled_input() ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By voxelv

I can’t get any _unhandled_input() from this setup:

scene tree

using _input()works, but I want the GUI to block input before letting the script handle it.

:bust_in_silhouette: Reply From: Xrayez

Unfortunately, there’s a bug that doesn’t allow ViewportContainer to forward unhandled input to its viewport children and only works for _input() right now.

As a workaround, you can try to forward the _unhandled_input() manually to viewport by extending ViewportContainer like so:

extends ViewportContainer

func _unhandled_input(event):
    $Viewport.unhandled_input(event)

This will allow to forward any unhandled input received by ViewportContainer to Viewport, hence to your custom camera node.

See the relevant issue pertaining to your question.