Hi guys, I'm currently using an Area2D node that switches scenes on collision and I'm getting <C++ Error>, <C++ Source>, and <Stack Trace> errors that I don't understand.
extends Area2D
@export var target_level : PackedScene
func _on_body_entered(body):
if body.name == "CharacterBody2D":
get_tree().change_scene_to_packed(target_level)
this is what the code for the collision logic looks like. So all it's doing is once my CharacterBody2D player touches the Area2D collision box, it ensures the Player is touching it (the first if-statement), then it changes the scene to a packed scene which I have declared above.
<C++ Error> Condition "locked" is true.
<C++ Source> scene/2d/area_2d.cpp:328 @ _clear_monitoring()
<Stack Trace> door_collision.gd:7 @ _on_body_entered()```
```E 0:00:20:0556 door_collision.gd:7 @ _on_body_entered(): Removing a CollisionObject node during a physics callback is not allowed and will cause undesired behavior. Remove with call_deferred() instead.
<C++ Source> scene/2d/collision_object_2d.cpp:98 @ _notification()
<Stack Trace> door_collision.gd:7 @ _on_body_entered()```
And these are all the details for what the error is saying. Is this enough informtion to get help with? I don't know how to fix these errors or why exactly they're happening. I notice they're C++ errors, but I'm writing in GDscript. Can someone help me out please? Thank you :)

