Bladeren bron

Add info on sending quit requests properly in Handling quit requests (#4911)

Co-authored-by: Hugo Locurcio <[email protected]>
insomniac_lemon 4 jaren geleden
bovenliggende
commit
2df983bf08
1 gewijzigde bestanden met toevoegingen van 21 en 0 verwijderingen
  1. 21 0
      tutorials/misc/handling_quit_requests.rst

+ 21 - 0
tutorials/misc/handling_quit_requests.rst

@@ -59,3 +59,24 @@ behavior to quit when quit is requested, this can be changed:
  .. code-tab:: csharp
 
     GetTree().SetAutoAcceptQuit(false);
+
+Sending your own quit notification
+----------------------------------
+
+While forcing the application to close can be done by calling :ref:`SceneTree.quit <class_SceneTree_method_quit>`,
+doing so will not send the quit *notification*. This means the function
+described above won't be called. Quitting by calling
+:ref:`SceneTree.quit <class_SceneTree_method_quit>` will not allow custom actions
+to complete (such as saving, confirming the quit, or debugging), even if you try
+to delay the line that forces the quit. 
+
+Instead, you should send a quit request:
+
+.. tabs::
+ .. code-tab:: gdscript GDScript
+
+    get_tree().notification(MainLoop.NOTIFICATION_WM_QUIT_REQUEST)
+
+ .. code-tab:: csharp
+
+    GetTree().Notification(MainLoop.NotificationWmQuitRequest)