Handling quit requests
Handling the notification
The has a special notification that is sent to all nodes when quit is requested: MainLoop.NOTIFICATION_WM_QUIT.
Handling it is done as follows (on any node):
C#
When developing mobile apps, quitting is not desired unless the user is on the main screen, so the behavior can be changed.
GDScript
C#