Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ItsAydonus |
if Input.is_action_just_pressed("pause"):
if is_paused == false:
$pause_popup.show()
get_tree().paused = true
$pause_popup.visible = true
is_paused = true
elif is_paused == true:
$pause_popup.hide()
$pause_popup.visible = false
get_tree().paused = false
is_paused = false
When using this, the game remains paused and I cannot close the popup menu. If I switch the order, the menu will open once and then never open again.
Pausing the scene tree stops the physics processing.
If true, the SceneTree is paused. Doing so will have the following behavior:
- 2D and 3D physics will be stopped. This includes signals and collision detection.
Popups are modal by default but I don’t know if they stop the scene tree processing.
If they do then you needn’t pause the scene tree.
If they don’t they you will need to add a state machine to bypass processing while in the ‘pause’ state or something similar.
LeslieS | 2023-01-16 00:42