Add nodes instance in GDScript in the tree before node instance in the editor

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ZimZardoz

Is it possible to create and add the “_level” instance (in GDScript) in the tree before “Cursor” (which one was instanced with the editor) ?

:bust_in_silhouette: Reply From: SQBX

First add `level as usual


Then after than line of code, write

move_child(_level, 0)

So your code should look something like

func _ready() -> void:
    _level = load("res://levels/level1.tscn").instance()
    move_child(_level, 0)