Error "_area_enter_tree: Condition "!E" is true." when removing a child and then re-adding it.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By blurrred

When removing a child node and then re-adding it, I get 3 errors:

area_enter_tree: Condition "!E" is true.
connect: Signal 'tree_entered' is already connected to given method '_area_exit_tree' in that object.
connect: Signal 'tree_exiting' is already connected to given method '_area_exit_tree' in that object.

I’ve isolated the cause of these errors as best I could. They only occur when I am removing and re-adding a node with two Areas with accompanying CollisionShapes.

I made a very basic project that only requires running test.tscn. Press 1 to remove and add a test node with 2 Area children. Press 2 to remove and add a test node with 1 Area child. Errors only appear in the first case and they appear every time the node is re-added.

Here is the test project: Gofile - Your all-in-one storage solution

:bust_in_silhouette: Reply From: yrtv

See: https://forum.godotengine.org/68193/delete-child-adding-another-closes-signal-connections-between

If I understand correctly, these errors are from signals that aren’t disconnected when the node leaves the scene tree and they try to re-connect themselves when the node is added back.

Are these errors only warnings that the signal is trying to connect itself multiple times?

blurrred | 2021-02-08 15:01

Yes. It should be safe, if you are not going to pass node to another scene.

yrtv | 2021-02-08 15:12