You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That's a weird description. What DUPLICATE_USE_INSTANCING does is it calls instantiate() on the original PackedScene if it's available. This causes the scene to be re-instantiated.
When you duplicate a scene instance, its children are not duplicated. Instead, the scene is re-instantiated with new children. Whether a node belongs to scene depends on its owner property, so when you remove owner, the nodes are no longer part of the scene and get duplicated normally. Thus your duplicate includes the unowned nodes and the nodes from re-instantiation.
tl;dr this is not a bug.
But maybe the documentation can be improved somewhere.
This would be documented by #68560.
"Duplicate using PackedScene.instantiate. If the node comes from a scene saved on disk, re-uses PackedScene.instantiate as the base for the duplicated node and its children.". (direct link)
Godot version
3.6 beta 1 and 4.0.3 RC1
Issue description
Node.duplicate()
doubles the children nodes under certain conditions.It doesn't occur otherwise.
Steps to reproduce
owner
property of the instance's children tonull
Minimal reproduction project
node_duplicate_creates_extra_nodes_godot3.zip
node_duplicate_creates_extra_nodes_godot4.zip
The text was updated successfully, but these errors were encountered: