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
In the context of a scene, duplicating one of its children which is also a scene and has @export-ed nodes will lead to the paths to those nodes referring to the original child scene, not the duplicated one.
Steps to reproduce
Create a "Root" scene, can be any node type.
Create a second "Child" scene; again, any node type.
Add any node (e.g., AnimationPlayer) as a child in the child scene.
Add a script to the Child scene root, which has an @export of a type matching the node in step 3.
Link the node from step 3 to the propery in step 4.
Instantiate the Child scene in the Root scene. (= name Child) Do NOT override the property, so that it remains in root.tscn as not having a value (i.e., uses default).
Duplicate the Child scene in the Root scene. (= name Child2)
At this point, Child will have a reference to its nested AnimationPlayer. However, Child2 will have a reference to ../Child/AnimationPlayer.
Unfortunately, this means that every time you duplicate a node, you have to click reset on every single one of its node properties—recently had to do this for 20 nodes with 6 properties each, and that was only for a small proof-of-concept.
The MRP included only contains up to step 6, and leaves step 7 as the repro. I've also got a GIF of the behavior here, which shows that both nodes use Child1/AnimationPlayer as their node after duplication.
Thanks @Mickeon, I think you're right. I had a cursory look at that thread before and thought node.duplicate() might be distinct from the editor's Duplicate menu, but upon closer reading of that issue and #83343, it seems to be the same functionality.
Tested versions
v4.2.1.stable.official [b09f793f5]
System information
Godot v4.2.1.stable - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1080 Ti (NVIDIA; 31.0.15.3161) - AMD Ryzen 9 3900X 12-Core Processor (24 Threads)
Issue description
In the context of a scene, duplicating one of its children which is also a scene and has
@export
-ed nodes will lead to the paths to those nodes referring to the original child scene, not the duplicated one.Steps to reproduce
AnimationPlayer
) as a child in the child scene.@export
of a type matching the node in step 3.Child
) Do NOT override the property, so that it remains inroot.tscn
as not having a value (i.e., uses default).Child2
)At this point,
Child
will have a reference to its nestedAnimationPlayer
. However,Child2
will have a reference to../Child/AnimationPlayer
.Unfortunately, this means that every time you duplicate a node, you have to click reset on every single one of its node properties—recently had to do this for 20 nodes with 6 properties each, and that was only for a small proof-of-concept.
The MRP included only contains up to step 6, and leaves step 7 as the repro. I've also got a GIF of the behavior here, which shows that both nodes use
Child1/AnimationPlayer
as their node after duplication.Minimal reproduction project (MRP)
godot-duplicate-node-path-bug.zip
The text was updated successfully, but these errors were encountered: