Just like in most other Android games, I want to use the Back Button as a Pause Button. What line of code do I need to write so that the Tabulated Lines underneath get executed when pressing the Android Back Button? Think if Input.is_action_pressed(), but for the Android Back Button instead of any other button.

18 days later
2 months later

@UnknownUser said: MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST:

I think this should be true when the back button is pressed

https://godotengine.org/qa/2718/handling-android-back-button

I have tried using this in my prototype Pause Object. This does not work for me because it causes the game is paused from the beginning, and cannot be unpaused because it pauses every frame, and it happens on all operating systems.

extends Node

func _process(_delta):
    if MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST:
	    get_tree().paused = true
2 years later