Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | shoyguer |
I’m getting a series of 4 errors every time my code runs this script:
var drop = load("res://data/scenes/items/passives/pa_" + equipment + ".tscn").instance()
drop.position = self.position + Vector2(50.0, 0.0).rotated(randf() * TAU)
get_parent().get_node("Pa_items").add_child(drop)
Yes, it is spawning a new node everytime it runs.
But I get micro-freezes in my game and also I get these errors:
How do I fix it?
I have no idea why this is happening.
This is what is written in each error (in order):
First:
E 0:00:05.337 body_set_shape_disabled: Can’t change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead.
<C++ Error> Condition “body->get_space() && flushing_queries” is true.
<C++ Source> servers/physics_2d/physics_2d_server_sw.cpp:730 @ body_set_shape_disabled()
Character.gd:149 @ drop_passive_item()
Character.gd:128 @ update_equipment()
Character.gd:446 @ _on_Collision_interacitons_area_entered()
Second:
E 0:00:05.341 body_set_shape_as_one_way_collision: Can’t change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead.
<C++ Error> Condition “body->get_space() && flushing_queries” is true.
<C++ Source> servers/physics_2d/physics_2d_server_sw.cpp:739 @ body_set_shape_as_one_way_collision()
Character.gd:149 @ drop_passive_item()
Character.gd:128 @ update_equipment()
Character.gd:446 @ _on_Collision_interacitons_area_entered()
Third:
E 0:00:05.349 body_set_shape_as_one_way_collision: Can’t change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead.
<C++ Error> Condition “body->get_space() && flushing_queries” is true.
<C++ Source> servers/physics_2d/physics_2d_server_sw.cpp:739 @ body_set_shape_as_one_way_collision()
Character.gd:149 @ drop_passive_item()
Character.gd:128 @ update_equipment()
Character.gd:446 @ _on_Collision_interacitons_area_entered()
Fourth
E 0:00:05.354 area_set_shape_disabled: Can’t change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead.
<C++ Error> Condition “area->get_space() && flushing_queries” is true.
<C++ Source> servers/physics_2d/physics_2d_server_sw.cpp:409 @ area_set_shape_disabled()
Character.gd:149 @ drop_passive_item()
Character.gd:128 @ update_equipment()
Character.gd:446 @ _on_Collision_interacitons_area_entered()