The Godot Community Forums are back up and running! Please read the the announcement post for important information on what happened. Thanks!

Getting error when attempt to unparent

I have an Area2D (item) that when 'picked up' will add itself to an Array.

Then I try to unparent itself with:

item.get_parent().remove_child(item)

Everything works, including the unparenting, but then I get this error:

Condition ' !area_in && !E ' is true.
scene/2d/area_2d.cpp:264 @ _area_inout()

Why is this error happening? Should I do something different to achieve this result?

Comments

  • TwistedTwiglegTwistedTwigleg Posts: 3,131Admin

    I think you have to set the monitoring property to false before unparenting and/or use a deferred call, I can't remember which right off. I remember having this issue at one point though...

    Looking at the line code in the error message, it appears to be caused by the node being removed from the tree, which is what you would expect. I think it isn't anything to worry about then.

  • AeternuxolusAeternuxolus Posts: 11Member

    I'm going look into the monitoring property, and see if I can get it to work without it popping an error. I think that red dot popping up really gets to me, lol..

    Thanks for response!

  • cyberealitycybereality Posts: 1,053Moderator

    I think this would work.

    item.get_parent().call_deferred("remove_child", item)
    
  • AeternuxolusAeternuxolus Posts: 11Member

    I switch it a deferred call but it still gives me the error.

    I'm at a loss, because it seems like it doesn't really do anything bad, but the red dot is driving me up the wall. So I'm going to see if I can just ignore this entire step and do it a different way.

    Thanks a lot for the suggestion!

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file