0 votes

Hello guys I'm doing a pause menu. my codes here:

extends CanvasLayer

func _input(event: InputEvent) -> void:
    if event.is_action_pressed("pause"):
        get_tree().paused = !get_tree().paused
        $".".visible = true

My continue button isnt workin because I paused my game. And I want to add code activating my continue , back to menu etc. buttons. How can I ?
(Im new on english and develoop game)

one more thing
how can use my continue button ?

extends Button

func _on_continue_Button_pause_pressed():
    $"../..".visible = false
    pass # Replace with function body.

I want fill x with continue func

Godot version godot engine v3.5.1.stable.mono.official
in Engine by (14 points)
edited by

2 Answers

+1 vote

In the editor if you look at your button you will find in the inspector right at the bottom you will find a pause mode, this will probably be set to inherit, change this too process and then it will work when you pause the game.

by (3,009 points)
0 votes

It paused because when you use get_tree().paused, it pauses everything in the SceneTree UNLESS that object is set to Process on Pause Mode. Go to whatever object needs to move/activate while paused, go to the Inspector on right and set it to Process and it should work.

Process Mode

Pssst. Also, if you're using any Control elements that cover the screen (like a ColorRect) make sure your mouse mode is set to pass.

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