mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-07 02:12:07 +03:00
Edit note on call_deferred() in Singletons (AutoLoad) (#2250)
* Edit note on call_deferred() in Singletons (AutoLoad)
- Rewrote the paragraph to be less wordy and more concise.
- Moved "Object.call_deferred()" to the beginning of the sentence to emphasize it.
* Specify purpose of call_deferred
Specify purpose of using call_deferred in this context.
(cherry picked from commit 2f27222d16)
This commit is contained in:
committed by
Reémi Verschelde
parent
962d12a692
commit
2deb52fa10
@@ -224,11 +224,10 @@ current scene and replace it with the requested one.
|
||||
GetTree().SetCurrentScene(CurrentScene);
|
||||
}
|
||||
|
||||
As mentioned in the comments above, we need to avoid the situation of deleting
|
||||
the current scene while it is still being used (i.e. its code is still running),
|
||||
so using :ref:`Object.call_deferred() <class_Object_method_call_deferred>`
|
||||
is required at this point. The result is that the second function will run
|
||||
at a later time when any code from the current scene has completed.
|
||||
Using :ref:`Object.call_deferred() <class_Object_method_call_deferred>`,
|
||||
the second function will only run once all code from the current scene has
|
||||
completed. Thus, the current scene will not be removed while it is
|
||||
still being used (i.e. its code is still running).
|
||||
|
||||
Finally, we need to fill the empty callback functions in the two scenes:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user