I've created a new instance, positioned it, and added it to the scene like this:
const Player = preload("res://player.tscn") func _physics_process(delta): if <outside display>: var newplayer = Player.instance() newplayer.position.x = 200 get_tree().get_root().add_child(newplayer) queue_free()
This works to the extent that the player is created in the right position and starts falling down with gravity. But the new player does not respond to any input, nor does it do anything if I
_ready function or the
_physics_process function. It seems its script is just never executed at all.
I've tried not
queue_free()'ing the old one, in case removing it is like removing its parent, but that doesn't help.
I've tried calling the
._ready() function on it manually, but that doesn't work either.
I've tried calling
request_ready() on the new player, but that doesn't run the
_ready() function either.
In tutorials, this is usually all they do to get a new instance into the world, so I'm not sure what I'm missing here.