How can I move node to sub node in SceneTree
Asked Answered
C

2

0

How can I move node C to the sub node of the master without deleting the node in the code?

Thanks.

Charade answered 14/11, 2023 at 13:31 Comment(0)
L
1

Charade There's also reparent()

$b/c.reparent($a)
Lonlona answered 14/11, 2023 at 14:46 Comment(0)
P
0

Charade Remove the node then add it back wherever you'd like

var c: Node = $"b/c"
$b.remove_child(c)
add_child(c)

This removes the node from b and adds it back as a child of master

Pedestrianize answered 14/11, 2023 at 14:21 Comment(0)
L
1

Charade There's also reparent()

$b/c.reparent($a)
Lonlona answered 14/11, 2023 at 14:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.