0 votes

Hi, I am using Godot Engine for a uni assignment.

In an Area, which has the area_enter signal connected, I try to queue_free() any node after a collision with my Area.

However, an error "Condition !isinsidetree() is true " shows up in the debugger after each node collision with my Area.

The sample code is as below :

func my_area_on_area_enter(area):
    # check if the parent of the area (the node) is inside tree
    print("Area in tree : ", area.get_parent().is_inside_tree())
    # delete the node (which has an extra area for collision purpose)

The Output terminal shows that for each node colliding with my Area, all of them are inside the scene tree but the error of "Condition !isinsidetree() is true " still appears nevertheless.

I have been googling and checked from godot github repo but I found no solution.

I appreciate greatly if anyone shares possible solution.

The godot version I am using is v2.1.3

Thanks !

in Engine by (12 points)

Could you, please, provide your scene tree structure?

1 Answer

+2 votes

This kind of thing can happen when youqueue_free()an object during collision checks or a signal callback.

Try changing the line to:


This will ensure that the body is freed on the next frame, after area_enter processing has completed.

by (21,920 points)
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.