_input(event) doesn't work as child of viewport

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By VincePrinceKing
:warning: Old Version Published before Godot 3 was released.

I noticed i _input(event) stops working after i go under a viewport node in the scene tree.
I switched Disable_Input in the viewports inspector on and off.

Tested the following script and as it is above the viewport it works just fine, as soon is in the viewports script or in a child of the viewports it stops working.

What exactly is the reason for this behaviour? and can i somehow work arround that? my Player.scn is a child to the viewport and i would prefer if a can handle all input for its movement inside of its own script.

func _ready():
	set_process_input(true) 
	
func _input(event):
	if (event.type == InputEvent.MOUSE_BUTTON):
		print("_inputMOUSE")
	if Input.is_action_pressed("ui_up"):
		print("_inputUP")
	if event.is_action_pressed("ui_down"):
		print("_inputDOWN")
:bust_in_silhouette: Reply From: avencherus

I’m not sure why it doesn’t receive events, but you can work around this by forwarding the event from the inputs that work above.

The sub viewport might have a function like: forwarded_event(event)

Depending on your implementation, for mouse coordinates you may have to transform them so they make sense in the receiving viewport.