+1 vote

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():

func _input(event):
    if (event.type == InputEvent.MOUSE_BUTTON):
    if Input.is_action_pressed("ui_up"):
    if event.is_action_pressed("ui_down"):
in Engine by (81 points)

1 Answer

0 votes

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.

by (5,206 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.