Add SceneTree.unload_current_scene()

Provides an obvious way to unload the currently loaded scene (which is nowhere to be found in the docs).
The SceneTree.change_scene_to() method must now always provide a valid PackedScene.

Fixes #63565.
This commit is contained in:
Juan Linietsky
2023-01-06 16:08:36 +01:00
parent b14f7aa9f9
commit e5f2c442c7
3 changed files with 23 additions and 8 deletions

View File

@@ -361,6 +361,7 @@ public:
Error change_scene_to_file(const String &p_path);
Error change_scene_to_packed(const Ref<PackedScene> &p_scene);
Error reload_current_scene();
void unload_current_scene();
Ref<SceneTreeTimer> create_timer(double p_delay_sec, bool p_process_always = true, bool p_process_in_physics = false, bool p_ignore_time_scale = false);
Ref<Tween> create_tween();