how to .duplicate a node while also copying all of its child nodes

Godot Version



I am new to coding, and decided it would be fun to try to make a level builder
the save function packs the scene, and it saves the Area2Ds… just not any of their child nodes
please help ive been trying to fix this for a week

How to save node like scene via code - #2 by system Does this help?

But generally for a level editor/similar you don’t save nodes or scenes but simpler data. For example for a tile-based map you might save a grid of tile ids.

Example, 0 could mean grass, 1 bush and 2 a tree. The idea is to save only as much data as is needed

var map = [
[0, 2, 0, 0],
[0, 0, 1, 0],
[0, 1, 0, 1],
[0, 2, 0, 0],

But level editors can be hard to make, especially for a beginner. Good luck!

You need to set the owner of each node to the root node that is to be packed into the scene.

Setting the owner causes it to be saved when the owner is saved iirc.