Godot Version
4.2
Question
Question/Clarification about this doc page.
While SceneTree.change_scene_to_packed() works for me, I’ve been unable to use Delete, Hide Current View, or Remove child like the docs suggested to make my other scene show up. Is there any sample code that shows how to make the manual scene transition work? Thanks
For reference, this is how I am trying to do it.
public partial class Game : Node3D
{
PackedScene Map;
PackedScene Battle;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
Map = ResourceLoader.Load<PackedScene>("res://Scenes/Map.tscn");
Battle = ResourceLoader.Load<PackedScene>("res://Scenes/Battle.tscn");
//GD.Print(GetTree().Root.GetChildren());
GetTree().Root.AddChild(Map.Instantiate());
//GetTree().ChangeSceneToPacked(Map);
GetTree().Root.RemoveChild(this);
GD.Print("F");
Visible = false;
//GetTree().ChangeSceneToFile("res://Scenes/Map.tscn");
}
public override void _Process(double delta)
{
}
}