godotengine / godotengine/godot
Dynamically added subchild in an instanced scene is not duplicated using Node.duplicate()
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in: 4.2.2.stable [15073afe3], 4.2.2 rc2, 4.2.2 rc3
- Not Reproducible in: 4.2.stable [46dc27791], 4.2.1.stable [b09f793f5], 4.2.2 rc1
### System information
Godot v4.2.2.stable - Windows 10.0.19045 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 2060 (NVIDIA; 31.0.15.3699) - Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz (12 Threads)
### Issue description
As the title states, nodes[C] added to any child[B] of an instanced scene[A] dynamically are not duplicated when calling Node.duplicate() on [A].
Meanwhile, it works if "[A] is not an instanced scene" or "calling Node.duplicate(7) which does not use PackedScene.instantiate() for duplicating".
For clearify the hierarchy relation, see the attachment below:

which [C] is a dynamically added node
Not sure if this is the desired behaviour with some internal changes inside Node.duplicate() after 4.2.2 rc2.
### Steps to reproduce
1. Create a scene.
2. Add a child to the scene.
3. Instance the scene into main scene in the editor.
4. Add a node to the child of the instanced scene with a script.
5. Duplicate the instanced scene in script.
### Minimal reproduction project (MRP)
[Test.zip](https://github.com/user-attachments/files/15605030/Test.zip)
Contributor guide
Assessment
This issue has not been assessed yet.