You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Call Node._input() on every Node in reverse order.
Call Control._gui_input().
Call Node._unhandled_input() on every Node in reverse order.
If object picking is on, call Area._input_event() on any picked object.
Repeat for the next Viewport in the tree.
If I understand that correctly, then when clicking the CollisionShape in this scene tree:
Spatial1
Spatial2
ViewportContainer
Viewport
Spatial3
Area
CollisionShape
The order of Spatial._input() and Area._input_event() calls should be:
Spatial2._input()
Spatial1._input()
Area._input_event()
Spatial3._input()
But It seems like Viewports receive input events in order with every other Node in the tree, rather than at the end. So the order is actually:
Spatial3._input()
Spatial2._input()
Spatial1._input()
Area._input_event()
I use Godot 3 node names here but the same happens in Godot 4.
The relevant Godot 4 code seems to be SceneTree::_call_input_pause(); it loops over the Nodes, and if a given node happens to be a SubViewportContainer, then Node::_call_input() > SubViewportContainer::input() > Viewport::push_input() > SceneTree::_call_input_pause(), which then loops over the Nodes under the SubViewportContainer.
Steps to reproduce
The attached Godot 3 project has the scene tree I described. Click the sphere and see the order logged in the console.
Yes, the "Using InputEvent tutorial" is outdated. I intend to update it, however there are a few bugfix pull-requests waiting for review (e.g. #58334), that will have an impact on that tutorial, so I would like to update the tutorial after they get merged.
I created this infographic to showcase how event-processing works, which matches your findings:
Godot version
3.5.1.stable, 4.0.beta
System information
Arch Linux
Issue description
I think this is a bug, but it's also possible I'm misunderstanding the documentation.
The Using InputEvent tutorial describes this sequence:
Node._input()
on every Node in reverse order.Control._gui_input()
.Node._unhandled_input()
on every Node in reverse order.Area._input_event()
on any picked object.If I understand that correctly, then when clicking the CollisionShape in this scene tree:
The order of
Spatial._input()
andArea._input_event()
calls should be:Spatial2._input()
Spatial1._input()
Area._input_event()
Spatial3._input()
But It seems like Viewports receive input events in order with every other Node in the tree, rather than at the end. So the order is actually:
Spatial3._input()
Spatial2._input()
Spatial1._input()
Area._input_event()
I use Godot 3 node names here but the same happens in Godot 4.
The relevant Godot 4 code seems to be
SceneTree::_call_input_pause()
; it loops over the Nodes, and if a given node happens to be a SubViewportContainer, thenNode::_call_input()
>SubViewportContainer::input()
>Viewport::push_input()
>SceneTree::_call_input_pause()
, which then loops over the Nodes under the SubViewportContainer.Steps to reproduce
The attached Godot 3 project has the scene tree I described. Click the sphere and see the order logged in the console.
Minimal reproduction project
input-test.zip
The text was updated successfully, but these errors were encountered: