I am developing a mobile app in godot(it's frustrating, wouldn't reccomend). How can I detect if the user pressed the back button or the back swipe like it's on modern smartphone ?
I found answers on the intenet, but they are all for Godot 3.
This is probably what you need:
On Android, NOTIFICATION_WM_GO_BACK_REQUEST is sent instead. Pressing the Back button will exit the application if Application > Config > Quit On Go Back is checked in the Project Settings (which is the default).
NOTIFICATION_WM_GO_BACK_REQUEST = 1007
Notification received from the OS when a go back request is sent (e.g. pressing the "Back" button on Android).
Specific to the Android platform.
https://docs.godotengine.org/en/4.1/classes/class_node.html#constants
Is it the escape key ?
This is probably what you need:
On Android, NOTIFICATION_WM_GO_BACK_REQUEST is sent instead. Pressing the Back button will exit the application if Application > Config > Quit On Go Back is checked in the Project Settings (which is the default).
NOTIFICATION_WM_GO_BACK_REQUEST = 1007
Notification received from the OS when a go back request is sent (e.g. pressing the "Back" button on Android).
Specific to the Android platform.
https://docs.godotengine.org/en/4.1/classes/class_node.html#constants
© 2022 - 2024 — McMap. All rights reserved.