mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
Add info on sending quit requests properly in Handling quit requests (#4911)
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user