0 votes

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.

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

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.

Tree state example and execution output
Tree state and execution output after EDIT

in Engine by (12 points)
edited by

Please log in or register to answer this question.

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 Frequently asked questions and 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 [email protected] with your username.