Use proper scene load function in all cases

This commit is contained in:
Marco 2025-02-21 12:09:42 +01:00
commit c5ed30f458
5 changed files with 12 additions and 5 deletions

View file

@ -27,7 +27,7 @@ public partial class GlobalState : Node
// The solution is to defer the load to a later time, when
// we can be sure that no code from the current scene is running:
CallDeferred(MethodName.DeferredGotoScene, path);
CallDeferred(MethodName.DeferredGotoScene, path, new MapStartDataResource());
}
public void GoToScene(string path, MapStartDataResource startData)
@ -53,6 +53,9 @@ public partial class GlobalState : Node
// Optionally, to make it compatible with the SceneTree.change_scene_to_file() API.
GetTree().CurrentScene = CurrentScene;
// // Update current scene here too
// CurrentScene = GetTree().Root.GetChild(-1);
if (startData is not null)
{
// Call deferred if it gives issues