0 votes

I have a scene tree that looks like this:
scene tree
Inside the script for the PauseMenu, I have code that toggles the paused value of the scene tree:

func _unhandled_input(event: InputEvent) -> void:
  if event.is_action_pressed("pause"):
    get_tree().paused = !get_tree().paused

I've also ensured that the PauseMenu's pause_mode is set to PAUSE_MODE_PROCESS (via the editor).

I am able to pause the game, but not unpause it. It seems that once the game is paused all my inputs are being either disregarded or consumed by some other node, unbeknownst to me.

Here is the quirk I'm confused about: if I move the PauseMenu node to instead be a sibling of Viewport (rather than a child), it all works. I am able to pause and unpause just fine.

Why is this happening? What can I do to fix this? Help is appreciated.

Godot version v3.5.1.stable.official [6fed1ffa3]
in Engine by (19 points)
edited by

1 Answer

0 votes
Best answer

After some troubleshooting I came across this reddit thread which led me to try setting the ViewportContainer's pause mode to Process. It worked, and I was able to pause/unpause just fine.

Of course, this means that all nodes within the viewport container don't pause, including gameplay related nodes. Not ideal, but I'm working around this by grouping nodes that should pause under one parent that has pause mode set to Stop, and vice versa for the nodes that shouldn't pause.

by (19 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 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.