Godot Version
godot 4.5
Question
I’m currently trying to make a level instantiator (to move between areas in a zelda-like) for my little pet project but for some reason trying to instantiate a scene the second time throws a null reference error?
As in the scene is instantiated once using a custom method(below), but if I call the custom method again with the same input parameters the native godot instantiate method throws an error?
func _load_new(newScene : PackedScene, spawn : int):
if scene != null:
scene.queue_free()
print(newScene)
scene = newScene.instantiate()
add_child(scene)
player.position = scene.spawns[spawn].global_position