Since the load function doesn't have an instantiate method in Godot 4.5, the following solution worked for me. Am I correct in understanding that the free() function doesn't free the entire sub-scene, but only its root node, and that I'm simply adding the object to the current window?
Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
#var scene01 = get_tree().change_scene_to_file("res://node_3d.tscn")
var scene01 = load("res://node_3d.tscn")
var pasce = PackedScene.new()
pasce.pack($Node3Dscene01)
#pasce.pack(scene01.get_node)
#var tscene = SceneTree.new()
var dfdsfsd = get_node($Node3Dscene01.get_path())
var dfgmkfmfdl = dfdsfsd.get_parent()
print(dfdsfsd.get_parent())
print(dfdsfsd.get_index())
#$Node3D.hide()
$Node3Dscene01.free()
print(dfdsfsd)
#pasce.cancel_free()
#scene01.cancel_free()
pasce.instantiate()
#get_tree().change_scene_to_packed(scene01)
#get_tree().change_scene_to_packed(pasce)
#get_tree().change_scene_to_file("res://main.tscn")
#var scene01 = preload("res://node_3d.gd")
dfgmkfmfdl.add_child(dfdsfsd)
get_tree().root.add_child(dfdsfsd)
print(get_tree().root)
#add_child()
#get_tree().change_scene_to_file("res://node_3_dscene_02.tscn")
Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass