|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
XavierH622 |
how do i execute code/a script/ a function when the user presses the ‘X’ button in the corner of the window so that i can save the game/close any open files/close any open network connections/etc?
|
|
|
|
Reply From: |
el_filipe |
Hello
Try with Godot _notification method
func _notification(what: int) -> void:
if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST || what == MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST:
print("bye !")
|
|
|
|
Reply From: |
magicalogic |
You can write code to handle quit notification as explained here.
https://docs.godotengine.org/en/stable/tutorials/inputs/handling_quit_requests.html