0 votes

So, here we are!

I have the following structure:

-Panel
--Control_0
---Button
---TextureFrame
--Control_1
---Button
---TextureFrame
--Control_2
---Button
---TextureFrame
--Control_3
---Button
---TextureFrame
--Control_4
---Button
---TextureFrame

And I try to reorganize it like

-Panel
--Control_0
---Button
---TextureFrame
---Control_1
--------Button
--------TextureFrame
---Control_2
--------Button
--------TextureFrame
--------Control_3
-----------Button
-----------TextureFrame
-----------Control_4
-------------------Button
-------------------TextureFrame

What I do is:

var my_node = get_node( "path" ); 
remove_child( my_node ); 
new_parent.add_child( my_node )

Why when doing "newparent.addchild(mynode)" the children of mynode are not visible? How can I make the TextureFrame and the Button appear again?

Thank you in advance, I don't really know how to debug this issue.

EDIT: I found that the nodes appear actually, but they are moved to places like 3478,6102

What is happening? I don't modify their position at all

in Engine by (89 points)
edited by

I guess Control_3 and Control_4 are located relative to Control_2 node.
Try to reset Control_3 and Control_4 position by set_pos(Vector2(0,0))

Ok, FINALLY! Thank you volzhs!
What you said helped me to find the solution! I set their global positions to the same position as their parent and done!

Thank you for your help! I didn't think about that.

1 Answer

0 votes
Best answer

I guess Control3 and Control4 are located relative to Control2 node.
Try to reset Control
3 and Control4 position by setpos(Vector2(0,0))

from comment

by (9,768 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.