0 votes

I have a number of static bodies handling mouse button input using _input_event.
I have a singleton with a function I want to call on mouse button pressed but only after I'm certain that the input was not handled by anything including my collision objects.

I've been using somewhat hacky workarounds but I'm hoping for a proper way of handling unhandled inputs.

The built in _unhandled_input doesn't suffice for my unhandled input since it is not the last priority input handling virtual method (why?).

Is there a way to handle input not handled by _input_event?

Godot version 3.2.2
in Engine by (58 points)

1 Answer

+1 vote
Best answer

According to the InputEvent documentation:
"5. Finally, if the event(CollisionObject.inputevent()) was unhandled, it will be passed to the next Viewport in the tree, otherwise it will be ignored."

So, adding another Viewport to the scene tree, then assign a script to it and capture the input with _unhandled_input(or any other input functions) should be able to handle input not handled by main viewport's _input_event

by (216 points)
selected by
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.