Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | matheuskknd |
Look the example image to understand the scene tree.
I’ve tested several configurations on Viewport and controls. Every things work fine when the tree is unpaused, but when I pause it, no input arrives to that Viewport or its child nodes, no matter I set PAUSE_MODE_PROCESS on them or not.
The button inside the Viewport pauses and unpauses the game when pressed (wich is not unpausing). I override all the input methods on both the button and the StaticBody2D, but when the tree is paused only the StaticBody2D prints _input and _unhandled_input. Nothing is printed anymore by the Button.
I also would like to know why _unhandled_input is not printed on the Button.
EDIT:
I finally found a configuration that makes the Viewport subtree nodes to receive Input as if they weren’t on a sub Viewport:
...
ViewportContainer (PAUSE_MODE_PROCESS)
Viewport (PAUSE_MODE_STOP)
And attaching a script to the ViewportContainer:
extends ViewportContainer
func _ready():
self.set_process_unhandled_key_input(true)
self.set_process_unhandled_input(true)
The only thing that is not happening as expected is the call order of _unhandled_input and _unhandled_key_input, see image 2. The Red box is a mouse motion input, ant the yellow box is a botton press and release.