how to save not opened scene

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

hi everyone, how can i save not opened scene?
i do:

packed_scene.pack(load("res://scenes/level_editor.tscn"))
ResourceSaver.save("user://"+level_name , packed_scene)

but it dont work

Isn’t the scene, “res://scenes/level_editor.tscn”, already saved? Why not copy it to the user’s directory?

Ertain | 2022-05-29 23:37

:bust_in_silhouette: Reply From: Ktotoetoia

i use this code to do this:

		dir.copy("res://scenes/level_editor.tscn", "user://"+level_name+".tscn")
		get_tree().change_scene_to(load(level_name))