Is it possible to save a level as a .scn? (Godot 3.0 Beta2)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By HarryCourt
:warning: Old Version Published before Godot 3 was released.

I’m working on a level editor, and I think the best approach would to save it as a .scn file that a user can open. Is this possible? If so, can someone explain to me how and/or where I can find some code or a project to help me in the right direction?

:bust_in_silhouette: Reply From: literalcitrus

You can use the PackedScene and ResourceSaver classes to save a node and it’s children into a .scn file.

var scene = get_node("Node")
var packed = PackedScene.new()
packed.pack(scene)
ResourceSaver.save("saved_scene.scn", packed)